Class: TrailerVote::Api::Product::Video::Urls
- Inherits:
-
Object
- Object
- TrailerVote::Api::Product::Video::Urls
- Includes:
- Composable::Get
- Defined in:
- lib/trailer_vote/api/product/video/urls.rb
Constant Summary collapse
- SUCCESS =
MediaTypes::ProductVideo.to_constructable.version(1).view('index')
- 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::Video
The api to deal with a product’s videos.
- #call(url: resolve_url) ⇒ Object
- #data ⇒ Object
-
#initialize(configuration:, product:, result: nil) ⇒ Urls
constructor
A new instance of Urls.
Methods included from Composable::Get
#etag, included, #links, #to_h, #to_i
Constructor Details
#initialize(configuration:, product:, result: nil) ⇒ Urls
Returns a new instance of Urls.
24 25 26 27 28 |
# File 'lib/trailer_vote/api/product/video/urls.rb', line 24 def initialize(configuration:, product:, result: nil) self.configuration = configuration self.product = product self.result = result end |
Instance Method Details
#back ⇒ TrailerVote::Api::Product::Video
Returns the api to deal with a product’s videos.
31 32 33 |
# File 'lib/trailer_vote/api/product/video/urls.rb', line 31 def back product.video end |
#call(url: resolve_url) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/trailer_vote/api/product/video/urls.rb', line 35 def call(url: resolve_url) return self if ok? || !url guard_network_errors do branch(resolve_client.headers(Headers::ACCEPT => ACCEPT).get(url)) end end |
#data ⇒ Object
42 43 44 |
# File 'lib/trailer_vote/api/product/video/urls.rb', line 42 def data to_h[:product_videos] end |