Class: TrailerVote::Api::Place::Children::Urls
- Inherits:
-
Object
- Object
- TrailerVote::Api::Place::Children::Urls
- Includes:
- Composable::Get
- Defined in:
- lib/trailer_vote/api/place/children/urls.rb
Constant Summary collapse
- SUCCESS =
MediaTypes::Place.to_constructable.version(3).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::Place::Children
The api to deal with a place's children.
- #call(url: resolve_url) ⇒ Object
- #data ⇒ Object
-
#initialize(configuration:, place:, 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:, place:, result: nil) ⇒ Urls
Returns a new instance of Urls.
24 25 26 27 28 |
# File 'lib/trailer_vote/api/place/children/urls.rb', line 24 def initialize(configuration:, place:, result: nil) self.configuration = configuration self.place = place self.result = result end |
Instance Method Details
#back ⇒ TrailerVote::Api::Place::Children
Returns the api to deal with a place's children.
31 32 33 |
# File 'lib/trailer_vote/api/place/children/urls.rb', line 31 def back place.children end |
#call(url: resolve_url) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/trailer_vote/api/place/children/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
43 44 45 |
# File 'lib/trailer_vote/api/place/children/urls.rb', line 43 def data to_h[:places] end |