Class: AdvancedBilling::ScheduledRenewalConfigurationItem

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

Overview

ScheduledRenewalConfigurationItem Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

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

Constructor Details

#initialize(id: SKIP, subscription_id: SKIP, subscription_renewal_configuration_id: SKIP, item_id: SKIP, item_type: SKIP, item_subclass: SKIP, price_point_id: SKIP, price_point_type: SKIP, quantity: SKIP, decimal_quantity: SKIP, created_at: SKIP, additional_properties: {}) ⇒ ScheduledRenewalConfigurationItem

Returns a new instance of ScheduledRenewalConfigurationItem.



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
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 97

def initialize(id: SKIP, subscription_id: SKIP,
               subscription_renewal_configuration_id: SKIP, item_id: SKIP,
               item_type: SKIP, item_subclass: SKIP, price_point_id: SKIP,
               price_point_type: SKIP, quantity: SKIP,
               decimal_quantity: SKIP, created_at: SKIP,
               additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @id = id unless id == SKIP
  @subscription_id = subscription_id unless subscription_id == SKIP
  unless subscription_renewal_configuration_id == SKIP
    @subscription_renewal_configuration_id =
      subscription_renewal_configuration_id
  end
  @item_id = item_id unless item_id == SKIP
  @item_type = item_type unless item_type == SKIP
  @item_subclass = item_subclass unless item_subclass == SKIP
  @price_point_id = price_point_id unless price_point_id == SKIP
  @price_point_type = price_point_type unless price_point_type == SKIP
  @quantity = quantity unless quantity == SKIP
  @decimal_quantity = decimal_quantity unless decimal_quantity == SKIP
  @created_at = created_at unless created_at == SKIP
end

Instance Attribute Details

#created_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


55
56
57
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 55

def created_at
  @created_at
end

#decimal_quantityString

TODO: Write general description for this method

Returns:

  • (String)


51
52
53
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 51

def decimal_quantity
  @decimal_quantity
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#item_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def item_id
  @item_id
end

#item_subclassString

TODO: Write general description for this method

Returns:

  • (String)


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

def item_subclass
  @item_subclass
end

#item_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def item_type
  @item_type
end

#price_point_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def price_point_id
  @price_point_id
end

#price_point_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def price_point_type
  @price_point_type
end

#quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def quantity
  @quantity
end

#subscription_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def subscription_id
  @subscription_id
end

#subscription_renewal_configuration_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def subscription_renewal_configuration_id
  @subscription_renewal_configuration_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
166
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 125

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : SKIP
  subscription_renewal_configuration_id =
    hash.key?('subscription_renewal_configuration_id') ? hash['subscription_renewal_configuration_id'] : SKIP
  item_id = hash.key?('item_id') ? hash['item_id'] : SKIP
  item_type = hash.key?('item_type') ? hash['item_type'] : SKIP
  item_subclass = hash.key?('item_subclass') ? hash['item_subclass'] : SKIP
  price_point_id =
    hash.key?('price_point_id') ? hash['price_point_id'] : SKIP
  price_point_type =
    hash.key?('price_point_type') ? hash['price_point_type'] : SKIP
  quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
  decimal_quantity =
    hash.key?('decimal_quantity') ? hash['decimal_quantity'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end

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

  # Create object from extracted values.
  ScheduledRenewalConfigurationItem.new(id: id,
                                        subscription_id: subscription_id,
                                        subscription_renewal_configuration_id: subscription_renewal_configuration_id,
                                        item_id: item_id,
                                        item_type: item_type,
                                        item_subclass: item_subclass,
                                        price_point_id: price_point_id,
                                        price_point_type: price_point_type,
                                        quantity: quantity,
                                        decimal_quantity: decimal_quantity,
                                        created_at: created_at,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash['subscription_renewal_configuration_id'] =
    'subscription_renewal_configuration_id'
  @_hash['item_id'] = 'item_id'
  @_hash['item_type'] = 'item_type'
  @_hash['item_subclass'] = 'item_subclass'
  @_hash['price_point_id'] = 'price_point_id'
  @_hash['price_point_type'] = 'price_point_type'
  @_hash['quantity'] = 'quantity'
  @_hash['decimal_quantity'] = 'decimal_quantity'
  @_hash['created_at'] = 'created_at'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 93

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    id
    subscription_id
    subscription_renewal_configuration_id
    item_id
    item_type
    item_subclass
    price_point_id
    price_point_type
    quantity
    decimal_quantity
    created_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



184
185
186
187
188
189
190
191
192
193
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 184

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, subscription_id: #{@subscription_id.inspect},"\
  " subscription_renewal_configuration_id: #{@subscription_renewal_configuration_id.inspect},"\
  " item_id: #{@item_id.inspect}, item_type: #{@item_type.inspect}, item_subclass:"\
  " #{@item_subclass.inspect}, price_point_id: #{@price_point_id.inspect}, price_point_type:"\
  " #{@price_point_type.inspect}, quantity: #{@quantity.inspect}, decimal_quantity:"\
  " #{@decimal_quantity.inspect}, created_at: #{@created_at.inspect}, additional_properties:"\
  " #{get_additional_properties}>"
end

#to_custom_created_atObject



168
169
170
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 168

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



173
174
175
176
177
178
179
180
181
# File 'lib/advanced_billing/models/scheduled_renewal_configuration_item.rb', line 173

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, subscription_id: #{@subscription_id},"\
  " subscription_renewal_configuration_id: #{@subscription_renewal_configuration_id}, item_id:"\
  " #{@item_id}, item_type: #{@item_type}, item_subclass: #{@item_subclass}, price_point_id:"\
  " #{@price_point_id}, price_point_type: #{@price_point_type}, quantity: #{@quantity},"\
  " decimal_quantity: #{@decimal_quantity}, created_at: #{@created_at}, additional_properties:"\
  " #{get_additional_properties}>"
end