Class: TrailerVote::Api::PushRecipeAndroid
- Inherits:
-
Object
- Object
- TrailerVote::Api::PushRecipeAndroid
- Includes:
- Composable::Get
- Defined in:
- lib/trailer_vote/api/push_recipe_android.rb
Constant Summary collapse
- SUCCESS =
MediaTypes::PushRecipeAndroid.to_constructable.version(1)
- FAILURE =
MediaTypes::Errors.to_constructable.version(1)
- ACCEPT =
[SUCCESS.to_s, FAILURE.to_s(0.1)].join(', ').freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #call(url: nil) ⇒ Object
-
#initialize(configuration: nil, result: nil) ⇒ PushRecipeAndroid
constructor
A new instance of PushRecipeAndroid.
Methods included from Composable::Get
#data, #etag, included, #links, #to_h, #to_i
Constructor Details
#initialize(configuration: nil, result: nil) ⇒ PushRecipeAndroid
Returns a new instance of PushRecipeAndroid.
16 17 18 19 |
# File 'lib/trailer_vote/api/push_recipe_android.rb', line 16 def initialize(configuration: nil, result: nil) self.configuration = configuration self.result = result end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/trailer_vote/api/push_recipe_android.rb', line 10 def client @client end |
Instance Method Details
#call(url: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/trailer_vote/api/push_recipe_android.rb', line 21 def call(url: nil) return self if ok? || !url local_client = client unless client uri = URI(url) local_client = TrailerVote::Api.default_unauthenticated_client local_client = local_client.basic_auth(user: uri.user, pass: uri.password) end guard_network_errors do branch(local_client.headers(Headers::ACCEPT => ACCEPT).get(url)) end end |