Class: AdvancedBilling::SubscriptionGroup

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

Overview

SubscriptionGroup Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(customer_id = SKIP, payment_profile = SKIP, payment_collection_method = SKIP, subscription_ids = SKIP, created_at = SKIP) ⇒ SubscriptionGroup

Returns a new instance of SubscriptionGroup.



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

def initialize(customer_id = SKIP, payment_profile = SKIP,
               payment_collection_method = SKIP, subscription_ids = SKIP,
               created_at = SKIP)
  @customer_id = customer_id unless customer_id == SKIP
  @payment_profile = payment_profile unless payment_profile == SKIP
  unless payment_collection_method == SKIP
    @payment_collection_method =
      payment_collection_method
  end
  @subscription_ids = subscription_ids unless subscription_ids == SKIP
  @created_at = created_at unless created_at == SKIP
end

Instance Attribute Details

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


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

def created_at
  @created_at
end

#customer_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def customer_id
  @customer_id
end

#payment_collection_methodString

TODO: Write general description for this method

Returns:

  • (String)


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

def payment_collection_method
  @payment_collection_method
end

#payment_profileSubscriptionGroupPaymentProfile

TODO: Write general description for this method



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

def payment_profile
  @payment_profile
end

#subscription_idsArray[Integer]

TODO: Write general description for this method

Returns:

  • (Array[Integer])


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

def subscription_ids
  @subscription_ids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
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.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP
  payment_profile = SubscriptionGroupPaymentProfile.from_hash(hash['payment_profile']) if
    hash['payment_profile']
  payment_collection_method =
    hash.key?('payment_collection_method') ? hash['payment_collection_method'] : SKIP
  subscription_ids =
    hash.key?('subscription_ids') ? hash['subscription_ids'] : SKIP
  created_at = hash.key?('created_at') ? hash['created_at'] : SKIP

  # Create object from extracted values.
  SubscriptionGroup.new(customer_id,
                        payment_profile,
                        payment_collection_method,
                        subscription_ids,
                        created_at)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/advanced_billing/models/subscription_group.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customer_id'] = 'customer_id'
  @_hash['payment_profile'] = 'payment_profile'
  @_hash['payment_collection_method'] = 'payment_collection_method'
  @_hash['subscription_ids'] = 'subscription_ids'
  @_hash['created_at'] = 'created_at'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/advanced_billing/models/subscription_group.rb', line 44

def self.optionals
  %w[
    customer_id
    payment_profile
    payment_collection_method
    subscription_ids
    created_at
  ]
end