Class: AdvancedBilling::SubscriptionGroupSignupResponse

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

Overview

SubscriptionGroupSignupResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(uid = SKIP, scheme = SKIP, customer_id = SKIP, payment_profile_id = SKIP, subscription_ids = SKIP, primary_subscription_id = SKIP, next_assessment_at = SKIP, state = SKIP, cancel_at_end_of_period = SKIP, subscriptions = SKIP, payment_collection_method = PaymentCollectionMethod::AUTOMATIC) ⇒ SubscriptionGroupSignupResponse

Returns a new instance of SubscriptionGroupSignupResponse.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 98

def initialize(
  uid = SKIP, scheme = SKIP, customer_id = SKIP, payment_profile_id = SKIP,
  subscription_ids = SKIP, primary_subscription_id = SKIP,
  next_assessment_at = SKIP, state = SKIP, cancel_at_end_of_period = SKIP,
  subscriptions = SKIP,
  payment_collection_method = PaymentCollectionMethod::AUTOMATIC
)
  @uid = uid unless uid == SKIP
  @scheme = scheme unless scheme == SKIP
  @customer_id = customer_id unless customer_id == SKIP
  @payment_profile_id = payment_profile_id unless payment_profile_id == SKIP
  @subscription_ids = subscription_ids unless subscription_ids == SKIP
  @primary_subscription_id = primary_subscription_id unless primary_subscription_id == SKIP
  @next_assessment_at = next_assessment_at unless next_assessment_at == SKIP
  @state = state unless state == SKIP
  @cancel_at_end_of_period = cancel_at_end_of_period unless cancel_at_end_of_period == SKIP
  @subscriptions = subscriptions unless subscriptions == SKIP
  unless payment_collection_method == SKIP
    @payment_collection_method =
      payment_collection_method
  end
end

Instance Attribute Details

#cancel_at_end_of_periodTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


46
47
48
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 46

def cancel_at_end_of_period
  @cancel_at_end_of_period
end

#customer_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def customer_id
  @customer_id
end

#next_assessment_atString

TODO: Write general description for this method

Returns:

  • (String)


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

def next_assessment_at
  @next_assessment_at
end

#payment_collection_methodPaymentCollectionMethod

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`.



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

def payment_collection_method
  @payment_collection_method
end

#payment_profile_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def payment_profile_id
  @payment_profile_id
end

#primary_subscription_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def primary_subscription_id
  @primary_subscription_id
end

#schemeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def scheme
  @scheme
end

#stateString

TODO: Write general description for this method

Returns:

  • (String)


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

def state
  @state
end

#subscription_idsArray[Integer]

TODO: Write general description for this method

Returns:

  • (Array[Integer])


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

def subscription_ids
  @subscription_ids
end

#subscriptionsArray[SubscriptionGroupItem]

TODO: Write general description for this method

Returns:



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

def subscriptions
  @subscriptions
end

#uidString

TODO: Write general description for this method

Returns:

  • (String)


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

def uid
  @uid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
158
159
160
161
162
163
164
165
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 122

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  uid = hash.key?('uid') ? hash['uid'] : SKIP
  scheme = hash.key?('scheme') ? hash['scheme'] : SKIP
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP
  payment_profile_id =
    hash.key?('payment_profile_id') ? hash['payment_profile_id'] : SKIP
  subscription_ids =
    hash.key?('subscription_ids') ? hash['subscription_ids'] : SKIP
  primary_subscription_id =
    hash.key?('primary_subscription_id') ? hash['primary_subscription_id'] : SKIP
  next_assessment_at =
    hash.key?('next_assessment_at') ? hash['next_assessment_at'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  cancel_at_end_of_period =
    hash.key?('cancel_at_end_of_period') ? hash['cancel_at_end_of_period'] : SKIP
  # Parameter is an array, so we need to iterate through it
  subscriptions = nil
  unless hash['subscriptions'].nil?
    subscriptions = []
    hash['subscriptions'].each do |structure|
      subscriptions << (SubscriptionGroupItem.from_hash(structure) if structure)
    end
  end

  subscriptions = SKIP unless hash.key?('subscriptions')
  payment_collection_method =
    hash['payment_collection_method'] ||= PaymentCollectionMethod::AUTOMATIC

  # Create object from extracted values.
  SubscriptionGroupSignupResponse.new(uid,
                                      scheme,
                                      customer_id,
                                      payment_profile_id,
                                      subscription_ids,
                                      primary_subscription_id,
                                      next_assessment_at,
                                      state,
                                      cancel_at_end_of_period,
                                      subscriptions,
                                      payment_collection_method)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['scheme'] = 'scheme'
  @_hash['customer_id'] = 'customer_id'
  @_hash['payment_profile_id'] = 'payment_profile_id'
  @_hash['subscription_ids'] = 'subscription_ids'
  @_hash['primary_subscription_id'] = 'primary_subscription_id'
  @_hash['next_assessment_at'] = 'next_assessment_at'
  @_hash['state'] = 'state'
  @_hash['cancel_at_end_of_period'] = 'cancel_at_end_of_period'
  @_hash['subscriptions'] = 'subscriptions'
  @_hash['payment_collection_method'] = 'payment_collection_method'
  @_hash
end

.nullablesObject

An array for nullable fields



94
95
96
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 94

def self.nullables
  []
end

.optionalsObject

An array for optional fields



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 77

def self.optionals
  %w[
    uid
    scheme
    customer_id
    payment_profile_id
    subscription_ids
    primary_subscription_id
    next_assessment_at
    state
    cancel_at_end_of_period
    subscriptions
    payment_collection_method
  ]
end