Sha256: 5e1fe0629355cae212c779f08426e8af2e565878068d2200805727a6e1dfa12a
Contents?: true
Size: 965 Bytes
Versions: 15
Compression:
Stored size: 965 Bytes
Contents
# frozen_string_literal: true module PriceHubble module Client # A high level client library for the PriceHubble Authentication API. class Authentication < Base # Perform a login request while sending the passed credentials. # # @param args [Hash{Symbol => Mixed}] the authentication credentials # @return [PriceHubble::Authentication, nil] the authentication entity, # or +nil+ on error 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 # Generate bang method variants bangers :login end end end
Version data entries
15 entries across 15 versions & 1 rubygems