Class: TrailerVote::Api::Product::Lookup
- Inherits:
-
Object
- Object
- TrailerVote::Api::Product::Lookup
- Includes:
- Composable::Common
- Defined in:
- lib/trailer_vote/api/product/lookup.rb
Overview
Looks up a product by a set of authority and identifiers in lookups
Constant Summary collapse
- CONTENT =
MediaTypes::ProductLookup.to_constructable.version(1)
- SUCCESS =
MediaTypes::Product.to_constructable.version(2)
- FAILURE =
MediaTypes::Errors.to_constructable.version(1)
- ACCEPT =
[SUCCESS.to_s, FAILURE.to_s(0.1)].join(', ').freeze
Instance Method Summary collapse
-
#back ⇒ TrailerVote::Api::Product
Api to deal with products.
- #call(data:, url: resolve_url) ⇒ Object
-
#initialize(configuration:) ⇒ Lookup
constructor
A new instance of Lookup.
Methods included from Composable::Common
Constructor Details
#initialize(configuration:) ⇒ Lookup
Returns a new instance of Lookup.
57 58 59 |
# File 'lib/trailer_vote/api/product/lookup.rb', line 57 def initialize(configuration:) self.configuration = configuration end |
Instance Method Details
#back ⇒ TrailerVote::Api::Product
Returns api to deal with products.
62 63 64 |
# File 'lib/trailer_vote/api/product/lookup.rb', line 62 def back configuration.product end |
#call(data:, url: resolve_url) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/trailer_vote/api/product/lookup.rb', line 66 def call(data:, url: resolve_url) body = encode(data) guard_network_errors do branch( resolve_client.headers( Headers::ACCEPT => ACCEPT, Headers::CONTENT_TYPE => "#{CONTENT}; charset=#{body.encoding.name}" ).post(url, body: body), data: data ) end end |