Class: AdvancedBilling::SubscriptionGroup
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::SubscriptionGroup
- Defined in:
- lib/advanced_billing/models/subscription_group.rb
Overview
SubscriptionGroup Model.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
The type of payment collection to be used in the subscription.
-
#customer_id ⇒ Integer
TODO: Write general description for this method.
-
#payment_collection_method ⇒ CollectionMethod
The type of payment collection to be used in the subscription.
-
#payment_profile ⇒ SubscriptionGroupPaymentProfile
TODO: Write general description for this method.
-
#subscription_ids ⇒ Array[Integer]
The type of payment collection to be used in the subscription.
-
#uid ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(uid: SKIP, customer_id: SKIP, payment_profile: SKIP, payment_collection_method: SKIP, subscription_ids: SKIP, created_at: SKIP, additional_properties: {}) ⇒ SubscriptionGroup
constructor
A new instance of SubscriptionGroup.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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(uid: SKIP, customer_id: SKIP, payment_profile: SKIP, payment_collection_method: SKIP, subscription_ids: SKIP, created_at: SKIP, additional_properties: {}) ⇒ SubscriptionGroup
Returns a new instance of SubscriptionGroup.
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 75 def initialize(uid: SKIP, customer_id: SKIP, payment_profile: SKIP, payment_collection_method: SKIP, subscription_ids: 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 @uid = uid unless uid == 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_at ⇒ DateTime
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.
44 45 46 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 44 def created_at @created_at end |
#customer_id ⇒ Integer
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 19 def customer_id @customer_id end |
#payment_collection_method ⇒ CollectionMethod
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.
30 31 32 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 30 def payment_collection_method @payment_collection_method end |
#payment_profile ⇒ SubscriptionGroupPaymentProfile
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 23 def payment_profile @payment_profile end |
#subscription_ids ⇒ Array[Integer]
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.
37 38 39 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 37 def subscription_ids @subscription_ids end |
#uid ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/subscription_group.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 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 95 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uid = hash.key?('uid') ? hash['uid'] : SKIP 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 = 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. SubscriptionGroup.new(uid: uid, customer_id: customer_id, payment_profile: payment_profile, payment_collection_method: payment_collection_method, subscription_ids: subscription_ids, created_at: created_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['uid'] = 'uid' @_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 |
.nullables ⇒ Object
An array for nullable fields
71 72 73 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 71 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 59 def self.optionals %w[ uid customer_id payment_profile payment_collection_method subscription_ids created_at ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
140 141 142 143 144 145 146 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 140 def inspect class_name = self.class.name.split('::').last "<#{class_name} uid: #{@uid.inspect}, customer_id: #{@customer_id.inspect},"\ " payment_profile: #{@payment_profile.inspect}, payment_collection_method:"\ " #{@payment_collection_method.inspect}, subscription_ids: #{@subscription_ids.inspect},"\ " created_at: #{@created_at.inspect}, additional_properties: #{get_additional_properties}>" end |
#to_custom_created_at ⇒ Object
126 127 128 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 126 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
131 132 133 134 135 136 137 |
# File 'lib/advanced_billing/models/subscription_group.rb', line 131 def to_s class_name = self.class.name.split('::').last "<#{class_name} uid: #{@uid}, customer_id: #{@customer_id}, payment_profile:"\ " #{@payment_profile}, payment_collection_method: #{@payment_collection_method},"\ " subscription_ids: #{@subscription_ids}, created_at: #{@created_at}, additional_properties:"\ " #{get_additional_properties}>" end |