Class: Ingenico::Direct::SDK::Domain::PaymentProduct

Inherits:
Ingenico::Direct::SDK::DataObject show all
Defined in:
lib/ingenico/direct/sdk/domain/payment_product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ingenico::Direct::SDK::DataObject

new_from_hash

Instance Attribute Details

#accounts_on_fileArray<Ingenico::Direct::SDK::Domain::AccountOnFile>

Returns the current value of accounts_on_file.

Returns:



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def accounts_on_file
  @accounts_on_file
end

#allows_recurringtrue/false

Returns the current value of allows_recurring.

Returns:

  • (true/false)

    the current value of allows_recurring



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def allows_recurring
  @allows_recurring
end

#allows_tokenizationtrue/false

Returns the current value of allows_tokenization.

Returns:

  • (true/false)

    the current value of allows_tokenization



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def allows_tokenization
  @allows_tokenization
end

#display_hintsIngenico::Direct::SDK::Domain::PaymentProductDisplayHints

Returns the current value of display_hints.

Returns:



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def display_hints
  @display_hints
end

#fieldsArray<Ingenico::Direct::SDK::Domain::PaymentProductField>

Returns the current value of fields.

Returns:



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def fields
  @fields
end

#idInteger

Returns the current value of id.

Returns:

  • (Integer)

    the current value of id



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def id
  @id
end

#payment_methodString

Returns the current value of payment_method.

Returns:

  • (String)

    the current value of payment_method



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def payment_method
  @payment_method
end

#payment_product_groupString

Returns the current value of payment_product_group.

Returns:

  • (String)

    the current value of payment_product_group



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def payment_product_group
  @payment_product_group
end

#uses_redirection_to3rd_partytrue/false

Returns the current value of uses_redirection_to3rd_party.

Returns:

  • (true/false)

    the current value of uses_redirection_to3rd_party



22
23
24
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 22

def uses_redirection_to3rd_party
  @uses_redirection_to3rd_party
end

Instance Method Details

#from_hash(hash) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 48

def from_hash(hash)
  super
  if hash.key? 'accountsOnFile'
    raise TypeError, "value '%s' is not an Array" % [hash['accountsOnFile']] unless hash['accountsOnFile'].is_a? Array
    @accounts_on_file = []
    hash['accountsOnFile'].each do |e|
      @accounts_on_file << Ingenico::Direct::SDK::Domain::AccountOnFile.new_from_hash(e)
    end
  end
  @allows_recurring = hash['allowsRecurring'] if hash.key? 'allowsRecurring'
  @allows_tokenization = hash['allowsTokenization'] if hash.key? 'allowsTokenization'
  if hash.key? 'displayHints'
    raise TypeError, "value '%s' is not a Hash" % [hash['displayHints']] unless hash['displayHints'].is_a? Hash
    @display_hints = Ingenico::Direct::SDK::Domain::PaymentProductDisplayHints.new_from_hash(hash['displayHints'])
  end
  if hash.key? 'fields'
    raise TypeError, "value '%s' is not an Array" % [hash['fields']] unless hash['fields'].is_a? Array
    @fields = []
    hash['fields'].each do |e|
      @fields << Ingenico::Direct::SDK::Domain::PaymentProductField.new_from_hash(e)
    end
  end
  @id = hash['id'] if hash.key? 'id'
  @payment_method = hash['paymentMethod'] if hash.key? 'paymentMethod'
  @payment_product_group = hash['paymentProductGroup'] if hash.key? 'paymentProductGroup'
  @uses_redirection_to3rd_party = hash['usesRedirectionTo3rdParty'] if hash.key? 'usesRedirectionTo3rdParty'
end

#to_hHash

Returns:

  • (Hash)


34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ingenico/direct/sdk/domain/payment_product.rb', line 34

def to_h
  hash = super
  hash['accountsOnFile'] = @accounts_on_file.collect(&:to_h) if @accounts_on_file
  hash['allowsRecurring'] = @allows_recurring unless @allows_recurring.nil?
  hash['allowsTokenization'] = @allows_tokenization unless @allows_tokenization.nil?
  hash['displayHints'] = @display_hints.to_h if @display_hints
  hash['fields'] = @fields.collect(&:to_h) if @fields
  hash['id'] = @id unless @id.nil?
  hash['paymentMethod'] = @payment_method unless @payment_method.nil?
  hash['paymentProductGroup'] = @payment_product_group unless @payment_product_group.nil?
  hash['usesRedirectionTo3rdParty'] = @uses_redirection_to3rd_party unless @uses_redirection_to3rd_party.nil?
  hash
end