Class: PriceHubble::Client::Authentication
- Defined in:
- lib/price_hubble/client/authentication.rb
Overview
A high level client library for the PriceHubble Authentication API.
Constant Summary
Constants included from Utils::Request
Instance Method Summary collapse
-
#login(**args) ⇒ PriceHubble::Authentication?
Perform a login request while sending the passed credentials.
Methods inherited from Base
Methods included from Utils::Bangers
Methods included from Utils::Decision
Methods included from Utils::Response
#assign_entity, #bang_entity, #failed?, #status?
Methods included from Utils::Request
#use_authentication, #use_default_context
Instance Method Details
#login(**args) ⇒ PriceHubble::Authentication?
Perform a login request while sending the passed credentials.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/price_hubble/client/authentication.rb', line 12 def login(**args) res = connection.post do |req| req.path = '/auth/login/credentials' req.body = args.except(:bang) use_default_context(req, :login) end decision(bang: args.fetch(:bang, false)) do |result| result.bang { PriceHubble::AuthenticationError.new(nil, res) } result.good { PriceHubble::Authentication.new(res.body) } successful?(res) end end |