Class: TrailerVote::Api::Product::Video::Create
- Inherits:
-
Object
- Object
- TrailerVote::Api::Product::Video::Create
- Includes:
- Composable::Common
- Defined in:
- lib/trailer_vote/api/product/video/create.rb
Constant Summary collapse
- CONTENT =
MediaTypes::ProductVideo.to_constructable.version(1).view('create')
- SUCCESS =
MediaTypes::ProductVideo.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 ⇒ Object
-
#call(data:, url: resolve_url) ⇒ TrailerVote::Api::Product::Video::Find
Create the image.
-
#initialize(configuration:, product:) ⇒ Create
constructor
A new instance of Create.
Methods included from Composable::Common
Constructor Details
#initialize(configuration:, product:) ⇒ Create
Returns a new instance of Create.
25 26 27 28 |
# File 'lib/trailer_vote/api/product/video/create.rb', line 25 def initialize(configuration:, product:) self.configuration = configuration self.product = product end |
Instance Method Details
#back ⇒ Object
30 31 32 |
# File 'lib/trailer_vote/api/product/video/create.rb', line 30 def back product.video end |
#call(data:, url: resolve_url) ⇒ TrailerVote::Api::Product::Video::Find
Create the image
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/trailer_vote/api/product/video/create.rb', line 42 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 |