Class: AdvancedBilling::NestedSubscriptionGroup

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

Overview

NestedSubscriptionGroup 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(uid: SKIP, scheme: SKIP, primary_subscription_id: SKIP, primary: SKIP, additional_properties: {}) ⇒ NestedSubscriptionGroup

Returns a new instance of NestedSubscriptionGroup.



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/advanced_billing/models/nested_subscription_group.rb', line 56

def initialize(uid: SKIP, scheme: SKIP, primary_subscription_id: SKIP,
               primary: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @uid = uid unless uid == SKIP
  @scheme = scheme unless scheme == SKIP
  @primary_subscription_id = primary_subscription_id unless primary_subscription_id == SKIP
  @primary = primary unless primary == SKIP
end

Instance Attribute Details

#primaryTrueClass | FalseClass

A boolean indicating whether the subscription is the primary in the group. Applicable to scheme 1.

Returns:

  • (TrueClass | FalseClass)


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

def primary
  @primary
end

#primary_subscription_idInteger

The subscription ID of the primary within the group. Applicable to scheme 1.

Returns:

  • (Integer)


24
25
26
# File 'lib/advanced_billing/models/nested_subscription_group.rb', line 24

def primary_subscription_id
  @primary_subscription_id
end

#schemeInteger

Whether the group is configured to rely on a primary subscription for billing. At this time, it will always be 1.

Returns:

  • (Integer)


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

def scheme
  @scheme
end

#uidString

The UID for the group

Returns:

  • (String)


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

def uid
  @uid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/advanced_billing/models/nested_subscription_group.rb', line 70

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
  primary_subscription_id =
    hash.key?('primary_subscription_id') ? hash['primary_subscription_id'] : SKIP
  primary = hash.key?('primary') ? hash['primary'] : SKIP

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

  # Create object from extracted values.
  NestedSubscriptionGroup.new(uid: uid,
                              scheme: scheme,
                              primary_subscription_id: primary_subscription_id,
                              primary: primary,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/advanced_billing/models/nested_subscription_group.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['scheme'] = 'scheme'
  @_hash['primary_subscription_id'] = 'primary_subscription_id'
  @_hash['primary'] = 'primary'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/advanced_billing/models/nested_subscription_group.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
48
49
# File 'lib/advanced_billing/models/nested_subscription_group.rb', line 42

def self.optionals
  %w[
    uid
    scheme
    primary_subscription_id
    primary
  ]
end