Class: Peddler::Endpoint
- Inherits:
-
Data
- Object
- Data
- Peddler::Endpoint
- Defined in:
- lib/peddler/endpoint.rb
Constant Summary collapse
- REGIONS =
{ # steep:ignore "us-east-1" => { selling_region: "North America", host: "sellingpartnerapi-na.amazon.com", }, "us-west-2" => { selling_region: "Far East", host: "sellingpartnerapi-fe.amazon.com", }, "eu-west-1" => { selling_region: "Europe", host: "sellingpartnerapi-eu.amazon.com", }, }
Instance Attribute Summary collapse
-
#aws_region ⇒ Object
readonly
Returns the value of attribute aws_region.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#selling_region ⇒ Object
readonly
Returns the value of attribute selling_region.
Class Method Summary collapse
Instance Method Summary collapse
-
#production ⇒ URI
steep:ignore:start.
- #sandbox ⇒ URI
Instance Attribute Details
#aws_region ⇒ Object (readonly)
Returns the value of attribute aws_region
6 7 8 |
# File 'lib/peddler/endpoint.rb', line 6 def aws_region @aws_region end |
#host ⇒ Object (readonly)
Returns the value of attribute host
6 7 8 |
# File 'lib/peddler/endpoint.rb', line 6 def host @host end |
#selling_region ⇒ Object (readonly)
Returns the value of attribute selling_region
6 7 8 |
# File 'lib/peddler/endpoint.rb', line 6 def selling_region @selling_region end |
Class Method Details
.all ⇒ Array<Endpoint>
25 26 27 |
# File 'lib/peddler/endpoint.rb', line 25 def all REGIONS.map { |aws_region, values| new(**values, aws_region: aws_region) } # steep:ignore end |
.find(aws_region) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/peddler/endpoint.rb', line 30 def find(aws_region) values = REGIONS.fetch(aws_region) do # steep:ignore raise ArgumentError, "#{aws_region} not found" end new(**values, aws_region: aws_region) end |
.find_by_selling_region(selling_region) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/peddler/endpoint.rb', line 39 def find_by_selling_region(selling_region) aws_region, values = REGIONS.find { |_, v| v[:selling_region] == selling_region } || # steep:ignore raise(ArgumentError, "#{selling_region} not found") new(**values, aws_region: aws_region) end |
Instance Method Details
#production ⇒ URI
steep:ignore:start
49 50 51 |
# File 'lib/peddler/endpoint.rb', line 49 def production URI::HTTPS.build(host: host) end |
#sandbox ⇒ URI
54 55 56 |
# File 'lib/peddler/endpoint.rb', line 54 def sandbox URI::HTTPS.build(host: "sandbox.#{host}") end |