Class: EwayRapid::CreateAccessCodeSharedResponse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_codeObject

Returns the value of attribute access_code.



5
6
7
# File 'lib/eway_rapid/entities/create_access_code_shared_response.rb', line 5

def access_code
  @access_code
end

#complete_checkout_urlObject

Returns the value of attribute complete_checkout_url.



9
10
11
# File 'lib/eway_rapid/entities/create_access_code_shared_response.rb', line 9

def complete_checkout_url
  @complete_checkout_url
end

#customerObject

Returns the value of attribute customer.



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

def customer
  @customer
end

#errorsObject

Returns the value of attribute errors.



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

def errors
  @errors
end

#form_action_urlObject

Returns the value of attribute form_action_url.



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

def form_action_url
  @form_action_url
end

#paymentObject

Returns the value of attribute payment.



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

def payment
  @payment
end

#shared_payment_urlObject

Returns the value of attribute shared_payment_url.



8
9
10
# File 'lib/eway_rapid/entities/create_access_code_shared_response.rb', line 8

def shared_payment_url
  @shared_payment_url
end

Class Method Details

.from_hash(hash) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/eway_rapid/entities/create_access_code_shared_response.rb', line 28

def self.from_hash(hash)
  create_access_code = CreateAccessCodeSharedResponse.new
  create_access_code.customer = InternalModels::Customer.from_hash(hash[Constants::CUSTOMER])
  create_access_code.payment = InternalModels::Payment.from_hash(hash[Constants::PAYMENT])
  create_access_code.access_code = hash[Constants::ACCESS_CODE]
  create_access_code.form_action_url = hash[Constants::FORM_ACTION_URL]
  create_access_code.errors = hash[Constants::ERRORS_CAPITALIZED]
  create_access_code.shared_payment_url = hash[Constants::SHARED_PAYMENT_URL]
  create_access_code.complete_checkout_url = hash[Constants::COMPLETE_CHECKOUT_URL]
  create_access_code
end

.from_json(json) ⇒ Object



23
24
25
26
# File 'lib/eway_rapid/entities/create_access_code_shared_response.rb', line 23

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

Instance Method Details

#to_json(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/eway_rapid/entities/create_access_code_shared_response.rb', line 11

def to_json(options={})
  {
      Constants::CUSTOMER               => customer,
      Constants::PAYMENT                => payment,
      Constants::ACCESS_CODE            => access_code,
      Constants::FORM_ACTION_URL        => form_action_url,
      Constants::ERRORS_CAPITALIZED     => errors,
      Constants::SHARED_PAYMENT_URL     => shared_payment_url,
      Constants::COMPLETE_CHECKOUT_URL  => complete_checkout_url
  }.to_json
end