Class: TrailerVote::Api::Place::Lookup
- Inherits:
-
Object
- Object
- TrailerVote::Api::Place::Lookup
- Includes:
- Composable::Common
- Defined in:
- lib/trailer_vote/api/place/lookup.rb
Overview
Looks up a place by a concatenated authority and identifier string
Constant Summary collapse
- SUCCESS =
MediaTypes::Place.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::Place
Api to deal with places.
- #call(authority:, identifier:) ⇒ 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.
42 43 44 |
# File 'lib/trailer_vote/api/place/lookup.rb', line 42 def initialize(configuration:) self.configuration = configuration end |
Instance Method Details
#back ⇒ TrailerVote::Api::Place
Returns api to deal with places.
47 48 49 |
# File 'lib/trailer_vote/api/place/lookup.rb', line 47 def back configuration.place end |
#call(authority:, identifier:) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/trailer_vote/api/place/lookup.rb', line 51 def call(authority:, identifier:) url = resolve_url(authority: , identifier: identifier) guard_network_errors do branch( resolve_client.headers(Headers::ACCEPT => ACCEPT).get(url, body: nil) ) end end |