Class: AdvancedBilling::SubscriptionGroupSignupSuccessData

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

Overview

SubscriptionGroupSignupSuccessData 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:, scheme:, customer_id:, payment_profile_id:, subscription_ids:, primary_subscription_id:, next_assessment_at:, state:, cancel_at_end_of_period:, additional_properties: {}) ⇒ SubscriptionGroupSignupSuccessData

Returns a new instance of SubscriptionGroupSignupSuccessData.



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

def initialize(uid:, scheme:, customer_id:, payment_profile_id:,
               subscription_ids:, primary_subscription_id:,
               next_assessment_at:, state:, cancel_at_end_of_period:,
               additional_properties: {})
  @uid = uid
  @scheme = scheme
  @customer_id = customer_id
  @payment_profile_id = payment_profile_id
  @subscription_ids = subscription_ids
  @primary_subscription_id = primary_subscription_id
  @next_assessment_at = next_assessment_at
  @state = state
  @cancel_at_end_of_period = cancel_at_end_of_period

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

Instance Attribute Details

#cancel_at_end_of_periodTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


47
48
49
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 47

def cancel_at_end_of_period
  @cancel_at_end_of_period
end

#customer_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


23
24
25
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 23

def customer_id
  @customer_id
end

#next_assessment_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


39
40
41
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 39

def next_assessment_at
  @next_assessment_at
end

#payment_profile_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


27
28
29
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 27

def payment_profile_id
  @payment_profile_id
end

#primary_subscription_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


35
36
37
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 35

def primary_subscription_id
  @primary_subscription_id
end

#schemeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


19
20
21
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 19

def scheme
  @scheme
end

#stateString

TODO: Write general description for this method

Returns:

  • (String)


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

def state
  @state
end

#subscription_idsArray[Integer]

TODO: Write general description for this method

Returns:

  • (Array[Integer])


31
32
33
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 31

def subscription_ids
  @subscription_ids
end

#uidString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 15

def uid
  @uid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
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
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  uid = hash.key?('uid') ? hash['uid'] : nil
  scheme = hash.key?('scheme') ? hash['scheme'] : nil
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : nil
  payment_profile_id =
    hash.key?('payment_profile_id') ? hash['payment_profile_id'] : nil
  subscription_ids =
    hash.key?('subscription_ids') ? hash['subscription_ids'] : nil
  primary_subscription_id =
    hash.key?('primary_subscription_id') ? hash['primary_subscription_id'] : nil
  next_assessment_at = if hash.key?('next_assessment_at')
                         (DateTimeHelper.from_rfc3339(hash['next_assessment_at']) if hash['next_assessment_at'])
                       end
  state = hash.key?('state') ? hash['state'] : nil
  cancel_at_end_of_period =
    hash.key?('cancel_at_end_of_period') ? hash['cancel_at_end_of_period'] : nil

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

  # Create object from extracted values.
  SubscriptionGroupSignupSuccessData.new(uid: uid,
                                         scheme: scheme,
                                         customer_id: customer_id,
                                         payment_profile_id: payment_profile_id,
                                         subscription_ids: subscription_ids,
                                         primary_subscription_id: primary_subscription_id,
                                         next_assessment_at: next_assessment_at,
                                         state: state,
                                         cancel_at_end_of_period: cancel_at_end_of_period,
                                         additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 50

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
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 65

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 137

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.uid,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.scheme,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.customer_id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.payment_profile_id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.subscription_ids,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.primary_subscription_id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.next_assessment_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.state,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.cancel_at_end_of_period,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['uid'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['scheme'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['customer_id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['payment_profile_id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['subscription_ids'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['primary_subscription_id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['next_assessment_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['state'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['cancel_at_end_of_period'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass })
  )
end

Instance Method Details

#to_custom_next_assessment_atObject



131
132
133
# File 'lib/advanced_billing/models/subscription_group_signup_success_data.rb', line 131

def to_custom_next_assessment_at
  DateTimeHelper.to_rfc3339(next_assessment_at)
end