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 =
[:profileid, :acctid, :respstat, :account, :respcode, :resptext, :respproc, :accttype, :expiry,
:name, :address, :city, :region, :country, :phone, :postal, :ssnl4, :email, :defaultacct, :license, :token]
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



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

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

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



10
11
12
# File 'lib/cardconnect/services/profile/profile_get_response.rb', line 10

def errors
  @errors
end

Instance Method Details

#bodyObject



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

def body
  body = {}
  FIELDS.each do |attr|
    body.merge!({attr => send(attr)})
  end
  body
end

#success?Boolean



21
22
23
# File 'lib/cardconnect/services/profile/profile_get_response.rb', line 21

def success?
  errors.empty?
end