Class: EwayRapid::DirectCustomerSearchResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/entities/direct_customer_search_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#customersObject

Returns the value of attribute customers.



3
4
5
# File 'lib/eway_rapid/entities/direct_customer_search_response.rb', line 3

def customers
  @customers
end

#errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/eway_rapid/entities/direct_customer_search_response.rb', line 4

def errors
  @errors
end

Class Method Details

.from_hash(hash) ⇒ Object



16
17
18
19
20
21
# File 'lib/eway_rapid/entities/direct_customer_search_response.rb', line 16

def self.from_hash(hash)
  response = DirectCustomerSearchResponse.new
  response.customers = InternalModels::Customer.from_array(hash[Constants::CUSTOMERS])
  response.errors = hash[Constants::ERRORS_CAPITALIZED]
  response
end

.from_json(json) ⇒ Object



11
12
13
14
# File 'lib/eway_rapid/entities/direct_customer_search_response.rb', line 11

def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6
7
8
9
# File 'lib/eway_rapid/entities/direct_customer_search_response.rb', line 6

def to_json(options={})
  {Constants::CUSTOMERS => customers,
   Constants::ERRORS => errors}.to_json
end