Sha256: 7ad8ea185eed8ef483f6ade5e09cb98b59bb9563664db291392186f28750a802
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
module Centaman class Service::AuthenticateMember < Centaman::Service include Centaman::JsonWrapper attr_reader :member_number, :last_name, :email, :password 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 def endpoint '/member_services/Authentication' end def object_class Centaman::Object::Member end def build_object(resp) return build_objects(resp) if resp.respond_to?(:map) return auth_error(resp) unless resp.respond_to?(:merge) @build_object ||= object_class.new(resp.merge(additional_hash_to_serialize_after_response)) end def options_hash { 'MemberNumber' => member_number, 'Surname' => last_name, 'Email' => email, 'Password' => password }.to_json end private def auth_error(resp) { error: resp.parsed_response || 'Authentication Failed. Invalid login credentials.' } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
centaman-2.0.0 | lib/centaman/service/authenticate_member.rb |
centaman-1.0.0 | lib/centaman/service/authenticate_member.rb |