Class: CardConnect::Service::ProfileGetResponse

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/cardconnect/services/profile/profile_get_response.rb

Constant Summary collapse

FIELDS =
[:gsacard, :profileid, :acctid, :respstat, :account,
:respcode, :resptext, :respproc, :accttype, :expiry,
:name, :address, :city, :region, :country, :phone, :postal,
:ssnl4, :email, :defaultacct, :license, :token, :auoptout]
STATUS_APPROVED =
'A'
STATUS_NOT_FOUND =
'C'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#set_attributes, #symbolize_keys

Constructor Details

#initialize(response) ⇒ ProfileGetResponse

Returns a new instance of ProfileGetResponse.



17
18
19
20
21
# File 'lib/cardconnect/services/profile/profile_get_response.rb', line 17

def initialize(response)
  set_attributes(response, FIELDS)
  @errors = []
  process_errors
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



12
13
14
# File 'lib/cardconnect/services/profile/profile_get_response.rb', line 12

def errors
  @errors
end

Instance Method Details

#bodyObject



27
28
29
# File 'lib/cardconnect/services/profile/profile_get_response.rb', line 27

def body
  FIELDS.collect{|attr| {attr => send(attr)} }.reduce({}, :merge)
end

#success?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/cardconnect/services/profile/profile_get_response.rb', line 23

def success?
  errors.empty?
end