class Centaman::Service::AuthenticateMember

Attributes

email[R]
last_name[R]
member_number[R]
password[R]

Public Instance Methods

after_init(args) click to toggle source
# File lib/centaman/service/authenticate_member.rb, line 7
def after_init(args)
  @member_number = args.fetch(:member_number, nil).try(:to_i)
  @last_name = args.fetch(:last_name, nil)
  @email = args.fetch(:email, nil)
  @password = args.fetch(:password, nil)
end
build_object(resp) click to toggle source
# File lib/centaman/service/authenticate_member.rb, line 22
def build_object(resp)
  return build_objects(resp) if resp.respond_to?(:map)

  return auth_error unless resp.respond_to?(:merge)
  @build_object ||= object_class.new(resp.merge(additional_hash_to_serialize_after_response))
end
endpoint() click to toggle source
# File lib/centaman/service/authenticate_member.rb, line 14
def endpoint
  '/member_services/Authentication'
end
object_class() click to toggle source
# File lib/centaman/service/authenticate_member.rb, line 18
def object_class
  Centaman::Object::Member
end
options_hash() click to toggle source
# File lib/centaman/service/authenticate_member.rb, line 29
def options_hash
  {
    'MemberNumber' => member_number,
    'Surname' => last_name,
    'Email' => email,
    'Password' => password
  }.to_json
end

Private Instance Methods

auth_error() click to toggle source
# File lib/centaman/service/authenticate_member.rb, line 40
def auth_error
  raise Centaman::Exceptions::CentamanUnauthorized.new('Invalid authentication request. Verify login credentials and try again.')
end