Class: OCI::OspGateway::Models::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/osp_gateway/models/subscription.rb

Overview

Subscription details object which extends the SubscriptionSummary

Constant Summary collapse

PLAN_TYPE_ENUM =
[
  PLAN_TYPE_FREE_TIER = 'FREE_TIER'.freeze,
  PLAN_TYPE_PAYG = 'PAYG'.freeze,
  PLAN_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
UPGRADE_STATE_ENUM =
[
  UPGRADE_STATE_PROMO = 'PROMO'.freeze,
  UPGRADE_STATE_SUBMITTED = 'SUBMITTED'.freeze,
  UPGRADE_STATE_ERROR = 'ERROR'.freeze,
  UPGRADE_STATE_UPGRADED = 'UPGRADED'.freeze,
  UPGRADE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
UPGRADE_STATE_DETAILS_ENUM =
[
  UPGRADE_STATE_DETAILS_TAX_ERROR = 'TAX_ERROR'.freeze,
  UPGRADE_STATE_DETAILS_UPGRADE_ERROR = 'UPGRADE_ERROR'.freeze,
  UPGRADE_STATE_DETAILS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Subscription

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/oci/osp_gateway/models/subscription.rb', line 183

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  self.id = attributes[:'id'] if attributes[:'id']

  self.subscription_plan_number = attributes[:'subscriptionPlanNumber'] if attributes[:'subscriptionPlanNumber']

  raise 'You cannot provide both :subscriptionPlanNumber and :subscription_plan_number' if attributes.key?(:'subscriptionPlanNumber') && attributes.key?(:'subscription_plan_number')

  self.subscription_plan_number = attributes[:'subscription_plan_number'] if attributes[:'subscription_plan_number']

  self.plan_type = attributes[:'planType'] if attributes[:'planType']

  raise 'You cannot provide both :planType and :plan_type' if attributes.key?(:'planType') && attributes.key?(:'plan_type')

  self.plan_type = attributes[:'plan_type'] if attributes[:'plan_type']

  self.time_start = attributes[:'timeStart'] if attributes[:'timeStart']

  raise 'You cannot provide both :timeStart and :time_start' if attributes.key?(:'timeStart') && attributes.key?(:'time_start')

  self.time_start = attributes[:'time_start'] if attributes[:'time_start']

  self.ship_to_cust_acct_site_id = attributes[:'shipToCustAcctSiteId'] if attributes[:'shipToCustAcctSiteId']

  raise 'You cannot provide both :shipToCustAcctSiteId and :ship_to_cust_acct_site_id' if attributes.key?(:'shipToCustAcctSiteId') && attributes.key?(:'ship_to_cust_acct_site_id')

  self.ship_to_cust_acct_site_id = attributes[:'ship_to_cust_acct_site_id'] if attributes[:'ship_to_cust_acct_site_id']

  self.ship_to_cust_acct_role_id = attributes[:'shipToCustAcctRoleId'] if attributes[:'shipToCustAcctRoleId']

  raise 'You cannot provide both :shipToCustAcctRoleId and :ship_to_cust_acct_role_id' if attributes.key?(:'shipToCustAcctRoleId') && attributes.key?(:'ship_to_cust_acct_role_id')

  self.ship_to_cust_acct_role_id = attributes[:'ship_to_cust_acct_role_id'] if attributes[:'ship_to_cust_acct_role_id']

  self. = attributes[:'billToCustAccountId'] if attributes[:'billToCustAccountId']

  raise 'You cannot provide both :billToCustAccountId and :bill_to_cust_account_id' if attributes.key?(:'billToCustAccountId') && attributes.key?(:'bill_to_cust_account_id')

  self. = attributes[:'bill_to_cust_account_id'] if attributes[:'bill_to_cust_account_id']

  self.is_intent_to_pay = attributes[:'isIntentToPay'] unless attributes[:'isIntentToPay'].nil?

  raise 'You cannot provide both :isIntentToPay and :is_intent_to_pay' if attributes.key?(:'isIntentToPay') && attributes.key?(:'is_intent_to_pay')

  self.is_intent_to_pay = attributes[:'is_intent_to_pay'] unless attributes[:'is_intent_to_pay'].nil?

  self.currency_code = attributes[:'currencyCode'] if attributes[:'currencyCode']

  raise 'You cannot provide both :currencyCode and :currency_code' if attributes.key?(:'currencyCode') && attributes.key?(:'currency_code')

  self.currency_code = attributes[:'currency_code'] if attributes[:'currency_code']

  self.gsi_org_code = attributes[:'gsiOrgCode'] if attributes[:'gsiOrgCode']

  raise 'You cannot provide both :gsiOrgCode and :gsi_org_code' if attributes.key?(:'gsiOrgCode') && attributes.key?(:'gsi_org_code')

  self.gsi_org_code = attributes[:'gsi_org_code'] if attributes[:'gsi_org_code']

  self.language_code = attributes[:'languageCode'] if attributes[:'languageCode']

  raise 'You cannot provide both :languageCode and :language_code' if attributes.key?(:'languageCode') && attributes.key?(:'language_code')

  self.language_code = attributes[:'language_code'] if attributes[:'language_code']

  self.organization_id = attributes[:'organizationId'] if attributes[:'organizationId']

  raise 'You cannot provide both :organizationId and :organization_id' if attributes.key?(:'organizationId') && attributes.key?(:'organization_id')

  self.organization_id = attributes[:'organization_id'] if attributes[:'organization_id']

  self.upgrade_state = attributes[:'upgradeState'] if attributes[:'upgradeState']

  raise 'You cannot provide both :upgradeState and :upgrade_state' if attributes.key?(:'upgradeState') && attributes.key?(:'upgrade_state')

  self.upgrade_state = attributes[:'upgrade_state'] if attributes[:'upgrade_state']

  self.upgrade_state_details = attributes[:'upgradeStateDetails'] if attributes[:'upgradeStateDetails']

  raise 'You cannot provide both :upgradeStateDetails and :upgrade_state_details' if attributes.key?(:'upgradeStateDetails') && attributes.key?(:'upgrade_state_details')

  self.upgrade_state_details = attributes[:'upgrade_state_details'] if attributes[:'upgrade_state_details']

  self.tax_info = attributes[:'taxInfo'] if attributes[:'taxInfo']

  raise 'You cannot provide both :taxInfo and :tax_info' if attributes.key?(:'taxInfo') && attributes.key?(:'tax_info')

  self.tax_info = attributes[:'tax_info'] if attributes[:'tax_info']

  self.payment_options = attributes[:'paymentOptions'] if attributes[:'paymentOptions']

  raise 'You cannot provide both :paymentOptions and :payment_options' if attributes.key?(:'paymentOptions') && attributes.key?(:'payment_options')

  self.payment_options = attributes[:'payment_options'] if attributes[:'payment_options']

  self.payment_gateway = attributes[:'paymentGateway'] if attributes[:'paymentGateway']

  raise 'You cannot provide both :paymentGateway and :payment_gateway' if attributes.key?(:'paymentGateway') && attributes.key?(:'payment_gateway')

  self.payment_gateway = attributes[:'payment_gateway'] if attributes[:'payment_gateway']

  self.billing_address = attributes[:'billingAddress'] if attributes[:'billingAddress']

  raise 'You cannot provide both :billingAddress and :billing_address' if attributes.key?(:'billingAddress') && attributes.key?(:'billing_address')

  self.billing_address = attributes[:'billing_address'] if attributes[:'billing_address']

  self.time_plan_upgrade = attributes[:'timePlanUpgrade'] if attributes[:'timePlanUpgrade']

  raise 'You cannot provide both :timePlanUpgrade and :time_plan_upgrade' if attributes.key?(:'timePlanUpgrade') && attributes.key?(:'time_plan_upgrade')

  self.time_plan_upgrade = attributes[:'time_plan_upgrade'] if attributes[:'time_plan_upgrade']
end

Instance Attribute Details

#bill_to_cust_account_idString

Bill to customer Account id.

Returns:

  • (String)


57
58
59
# File 'lib/oci/osp_gateway/models/subscription.rb', line 57

def 
  @bill_to_cust_account_id
end

#billing_addressOCI::OspGateway::Models::BillingAddress



98
99
100
# File 'lib/oci/osp_gateway/models/subscription.rb', line 98

def billing_address
  @billing_address
end

#currency_codeString

Currency code

Returns:

  • (String)


65
66
67
# File 'lib/oci/osp_gateway/models/subscription.rb', line 65

def currency_code
  @currency_code
end

#gsi_org_codeString

GSI Subscription external code.

Returns:

  • (String)


69
70
71
# File 'lib/oci/osp_gateway/models/subscription.rb', line 69

def gsi_org_code
  @gsi_org_code
end

#idString

Subscription id identifier (OCID).

Returns:

  • (String)


33
34
35
# File 'lib/oci/osp_gateway/models/subscription.rb', line 33

def id
  @id
end

#is_intent_to_payBOOLEAN

Payment intension.

Returns:

  • (BOOLEAN)


61
62
63
# File 'lib/oci/osp_gateway/models/subscription.rb', line 61

def is_intent_to_pay
  @is_intent_to_pay
end

#language_codeString

Language short code (en, de, hu, etc)

Returns:

  • (String)


73
74
75
# File 'lib/oci/osp_gateway/models/subscription.rb', line 73

def language_code
  @language_code
end

#organization_idString

GSI organization external identifier.

Returns:

  • (String)


77
78
79
# File 'lib/oci/osp_gateway/models/subscription.rb', line 77

def organization_id
  @organization_id
end

#payment_gatewayOCI::OspGateway::Models::PaymentGateway



95
96
97
# File 'lib/oci/osp_gateway/models/subscription.rb', line 95

def payment_gateway
  @payment_gateway
end

#payment_optionsArray<OCI::OspGateway::Models::PaymentOption>

Payment option list of a subscription.



92
93
94
# File 'lib/oci/osp_gateway/models/subscription.rb', line 92

def payment_options
  @payment_options
end

#plan_typeString

Subscription plan type.

Returns:

  • (String)


41
42
43
# File 'lib/oci/osp_gateway/models/subscription.rb', line 41

def plan_type
  @plan_type
end

#ship_to_cust_acct_role_idString

Ship to customer account role.

Returns:

  • (String)


53
54
55
# File 'lib/oci/osp_gateway/models/subscription.rb', line 53

def ship_to_cust_acct_role_id
  @ship_to_cust_acct_role_id
end

#ship_to_cust_acct_site_idString

Ship to customer account site address id.

Returns:

  • (String)


49
50
51
# File 'lib/oci/osp_gateway/models/subscription.rb', line 49

def ship_to_cust_acct_site_id
  @ship_to_cust_acct_site_id
end

#subscription_plan_numberString

**[Required]** Subscription plan number.

Returns:

  • (String)


37
38
39
# File 'lib/oci/osp_gateway/models/subscription.rb', line 37

def subscription_plan_number
  @subscription_plan_number
end

#tax_infoOCI::OspGateway::Models::TaxInfo



88
89
90
# File 'lib/oci/osp_gateway/models/subscription.rb', line 88

def tax_info
  @tax_info
end

#time_plan_upgradeDateTime

Date of upgrade/conversion when planType changed from FREE_TIER to PAYG

Returns:

  • (DateTime)


102
103
104
# File 'lib/oci/osp_gateway/models/subscription.rb', line 102

def time_plan_upgrade
  @time_plan_upgrade
end

#time_startDateTime

Start date of the subscription.

Returns:

  • (DateTime)


45
46
47
# File 'lib/oci/osp_gateway/models/subscription.rb', line 45

def time_start
  @time_start
end

#upgrade_stateString

Status of the upgrade.

Returns:

  • (String)


81
82
83
# File 'lib/oci/osp_gateway/models/subscription.rb', line 81

def upgrade_state
  @upgrade_state
end

#upgrade_state_detailsString

This field is used to describe the Upgrade State in case of error (E.g. Upgrade failure caused by interfacing Tax details- TaxError)

Returns:

  • (String)


85
86
87
# File 'lib/oci/osp_gateway/models/subscription.rb', line 85

def upgrade_state_details
  @upgrade_state_details
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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/oci/osp_gateway/models/subscription.rb', line 105

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'subscription_plan_number': :'subscriptionPlanNumber',
    'plan_type': :'planType',
    'time_start': :'timeStart',
    'ship_to_cust_acct_site_id': :'shipToCustAcctSiteId',
    'ship_to_cust_acct_role_id': :'shipToCustAcctRoleId',
    'bill_to_cust_account_id': :'billToCustAccountId',
    'is_intent_to_pay': :'isIntentToPay',
    'currency_code': :'currencyCode',
    'gsi_org_code': :'gsiOrgCode',
    'language_code': :'languageCode',
    'organization_id': :'organizationId',
    'upgrade_state': :'upgradeState',
    'upgrade_state_details': :'upgradeStateDetails',
    'tax_info': :'taxInfo',
    'payment_options': :'paymentOptions',
    'payment_gateway': :'paymentGateway',
    'billing_address': :'billingAddress',
    'time_plan_upgrade': :'timePlanUpgrade'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/oci/osp_gateway/models/subscription.rb', line 132

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'subscription_plan_number': :'String',
    'plan_type': :'String',
    'time_start': :'DateTime',
    'ship_to_cust_acct_site_id': :'String',
    'ship_to_cust_acct_role_id': :'String',
    'bill_to_cust_account_id': :'String',
    'is_intent_to_pay': :'BOOLEAN',
    'currency_code': :'String',
    'gsi_org_code': :'String',
    'language_code': :'String',
    'organization_id': :'String',
    'upgrade_state': :'String',
    'upgrade_state_details': :'String',
    'tax_info': :'OCI::OspGateway::Models::TaxInfo',
    'payment_options': :'Array<OCI::OspGateway::Models::PaymentOption>',
    'payment_gateway': :'OCI::OspGateway::Models::PaymentGateway',
    'billing_address': :'OCI::OspGateway::Models::BillingAddress',
    'time_plan_upgrade': :'DateTime'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/oci/osp_gateway/models/subscription.rb', line 343

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    subscription_plan_number == other.subscription_plan_number &&
    plan_type == other.plan_type &&
    time_start == other.time_start &&
    ship_to_cust_acct_site_id == other.ship_to_cust_acct_site_id &&
    ship_to_cust_acct_role_id == other.ship_to_cust_acct_role_id &&
     == other. &&
    is_intent_to_pay == other.is_intent_to_pay &&
    currency_code == other.currency_code &&
    gsi_org_code == other.gsi_org_code &&
    language_code == other.language_code &&
    organization_id == other.organization_id &&
    upgrade_state == other.upgrade_state &&
    upgrade_state_details == other.upgrade_state_details &&
    tax_info == other.tax_info &&
    payment_options == other.payment_options &&
    payment_gateway == other.payment_gateway &&
    billing_address == other.billing_address &&
    time_plan_upgrade == other.time_plan_upgrade
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/oci/osp_gateway/models/subscription.rb', line 391

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


371
372
373
# File 'lib/oci/osp_gateway/models/subscription.rb', line 371

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



380
381
382
# File 'lib/oci/osp_gateway/models/subscription.rb', line 380

def hash
  [id, subscription_plan_number, plan_type, time_start, ship_to_cust_acct_site_id, ship_to_cust_acct_role_id, , is_intent_to_pay, currency_code, gsi_org_code, language_code, organization_id, upgrade_state, upgrade_state_details, tax_info, payment_options, payment_gateway, billing_address, time_plan_upgrade].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



424
425
426
427
428
429
430
431
432
433
# File 'lib/oci/osp_gateway/models/subscription.rb', line 424

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



418
419
420
# File 'lib/oci/osp_gateway/models/subscription.rb', line 418

def to_s
  to_hash.to_s
end