Class: TrailerVote::Api::Product::Place::Link
- Inherits:
-
Object
- Object
- TrailerVote::Api::Product::Place::Link
- Includes:
- Composable::Common
- Defined in:
- lib/trailer_vote/api/product/place/link.rb
Constant Summary collapse
- CONTENT =
MediaTypes::ProductPlaceLink.to_constructable.version(1).view('create')
- SUCCESS =
MediaTypes::ProductPlaceLink.to_constructable.version(1)
- 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::Place
The api to deal with the product places.
- #call(data:, url: resolve_url) ⇒ Object
-
#initialize(configuration:, product:) ⇒ Link
constructor
A new instance of Link.
Methods included from Composable::Common
Constructor Details
#initialize(configuration:, product:) ⇒ Link
Returns a new instance of Link.
27 28 29 30 |
# File 'lib/trailer_vote/api/product/place/link.rb', line 27 def initialize(configuration:, product:) self.configuration = configuration self.product = product end |
Instance Method Details
#back ⇒ TrailerVote::Api::Product::Place
Returns the api to deal with the product places.
33 34 35 |
# File 'lib/trailer_vote/api/product/place/link.rb', line 33 def back product.place end |
#call(data:, url: resolve_url) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/trailer_vote/api/product/place/link.rb', line 37 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 |