Class: AdvancedBilling::SubscriptionGroupSignupFailureData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/subscription_group_signup_failure_data.rb

Overview

SubscriptionGroupSignupFailureData Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(payer_id: SKIP, payer_reference: SKIP, payment_profile_id: SKIP, payment_collection_method: SKIP, payer_attributes: SKIP, credit_card_attributes: SKIP, bank_account_attributes: SKIP, subscriptions: SKIP, additional_properties: {}) ⇒ SubscriptionGroupSignupFailureData

Returns a new instance of SubscriptionGroupSignupFailureData.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 77

def initialize(payer_id: SKIP, payer_reference: SKIP,
               payment_profile_id: SKIP, payment_collection_method: SKIP,
               payer_attributes: SKIP, credit_card_attributes: SKIP,
               bank_account_attributes: SKIP, subscriptions: SKIP,
               additional_properties: {})
  @payer_id = payer_id unless payer_id == SKIP
  @payer_reference = payer_reference unless payer_reference == SKIP
  @payment_profile_id = payment_profile_id unless payment_profile_id == SKIP
  unless payment_collection_method == SKIP
    @payment_collection_method =
      payment_collection_method
  end
  @payer_attributes = payer_attributes unless payer_attributes == SKIP
  @credit_card_attributes = credit_card_attributes unless credit_card_attributes == SKIP
  @bank_account_attributes =  unless  == SKIP
  @subscriptions = subscriptions unless subscriptions == SKIP

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#bank_account_attributesSubscriptionGroupBankAccount

TODO: Write general description for this method



38
39
40
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 38

def 
  @bank_account_attributes
end

#credit_card_attributesSubscriptionGroupCreditCard

TODO: Write general description for this method



34
35
36
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 34

def credit_card_attributes
  @credit_card_attributes
end

#payer_attributesPayerAttributes

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 30

def payer_attributes
  @payer_attributes
end

#payer_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 14

def payer_id
  @payer_id
end

#payer_referenceString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 18

def payer_reference
  @payer_reference
end

#payment_collection_methodString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 26

def payment_collection_method
  @payment_collection_method
end

#payment_profile_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 22

def payment_profile_id
  @payment_profile_id
end

#subscriptionsArray[SubscriptionGroupSignupItem]

TODO: Write general description for this method

Returns:



42
43
44
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 42

def subscriptions
  @subscriptions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 101

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payer_id = hash.key?('payer_id') ? hash['payer_id'] : SKIP
  payer_reference =
    hash.key?('payer_reference') ? hash['payer_reference'] : SKIP
  payment_profile_id =
    hash.key?('payment_profile_id') ? hash['payment_profile_id'] : SKIP
  payment_collection_method =
    hash.key?('payment_collection_method') ? hash['payment_collection_method'] : SKIP
  payer_attributes = PayerAttributes.from_hash(hash['payer_attributes']) if
    hash['payer_attributes']
  if hash['credit_card_attributes']
    credit_card_attributes = SubscriptionGroupCreditCard.from_hash(hash['credit_card_attributes'])
  end
  if hash['bank_account_attributes']
     = SubscriptionGroupBankAccount.from_hash(hash['bank_account_attributes'])
  end
  # Parameter is an array, so we need to iterate through it
  subscriptions = nil
  unless hash['subscriptions'].nil?
    subscriptions = []
    hash['subscriptions'].each do |structure|
      subscriptions << (SubscriptionGroupSignupItem.from_hash(structure) if structure)
    end
  end

  subscriptions = SKIP unless hash.key?('subscriptions')

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  SubscriptionGroupSignupFailureData.new(payer_id: payer_id,
                                         payer_reference: payer_reference,
                                         payment_profile_id: payment_profile_id,
                                         payment_collection_method: payment_collection_method,
                                         payer_attributes: payer_attributes,
                                         credit_card_attributes: credit_card_attributes,
                                         bank_account_attributes: ,
                                         subscriptions: subscriptions,
                                         additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payer_id'] = 'payer_id'
  @_hash['payer_reference'] = 'payer_reference'
  @_hash['payment_profile_id'] = 'payment_profile_id'
  @_hash['payment_collection_method'] = 'payment_collection_method'
  @_hash['payer_attributes'] = 'payer_attributes'
  @_hash['credit_card_attributes'] = 'credit_card_attributes'
  @_hash['bank_account_attributes'] = 'bank_account_attributes'
  @_hash['subscriptions'] = 'subscriptions'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 59

def self.optionals
  %w[
    payer_id
    payer_reference
    payment_profile_id
    payment_collection_method
    payer_attributes
    credit_card_attributes
    bank_account_attributes
    subscriptions
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



148
149
150
151
152
153
154
# File 'lib/advanced_billing/models/subscription_group_signup_failure_data.rb', line 148

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end