Class: AdvancedBilling::SubscriptionGroupSignup

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

Overview

SubscriptionGroupSignup Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

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

Returns a new instance of SubscriptionGroupSignup.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 91

def initialize(subscriptions:, payment_profile_id: SKIP, payer_id: SKIP,
               payer_reference: SKIP, payment_collection_method: SKIP,
               payer_attributes: SKIP, credit_card_attributes: SKIP,
               bank_account_attributes: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @payment_profile_id = payment_profile_id unless payment_profile_id == SKIP
  @payer_id = payer_id unless payer_id == SKIP
  @payer_reference = payer_reference unless payer_reference == 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
end

Instance Attribute Details

#bank_account_attributesSubscriptionGroupBankAccount

The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - ‘invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.



50
51
52
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 50

def 
  @bank_account_attributes
end

#credit_card_attributesSubscriptionGroupCreditCard

The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - ‘invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.



43
44
45
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 43

def credit_card_attributes
  @credit_card_attributes
end

#payer_attributesPayerAttributes

The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - ‘invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.

Returns:



36
37
38
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 36

def payer_attributes
  @payer_attributes
end

#payer_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def payer_id
  @payer_id
end

#payer_referenceString

TODO: Write general description for this method

Returns:

  • (String)


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

def payer_reference
  @payer_reference
end

#payment_collection_methodCollectionMethod

The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - ‘invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.

Returns:



29
30
31
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 29

def payment_collection_method
  @payment_collection_method
end

#payment_profile_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def payment_profile_id
  @payment_profile_id
end

#subscriptionsArray[SubscriptionGroupSignupItem]

The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - ‘invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.

Returns:



57
58
59
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 57

def subscriptions
  @subscriptions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 114

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # 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 = nil unless hash.key?('subscriptions')
  payment_profile_id =
    hash.key?('payment_profile_id') ? hash['payment_profile_id'] : SKIP
  payer_id = hash.key?('payer_id') ? hash['payer_id'] : SKIP
  payer_reference =
    hash.key?('payer_reference') ? hash['payer_reference'] : 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

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

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

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_profile_id'] = 'payment_profile_id'
  @_hash['payer_id'] = 'payer_id'
  @_hash['payer_reference'] = 'payer_reference'
  @_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



87
88
89
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 87

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/advanced_billing/models/subscription_group_signup.rb', line 74

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