Class: AdvancedBilling::SubscriptionComponentSubscription

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

Overview

An optional object, will be returned if provided ‘include=subscription` query param.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(state = SKIP, updated_at = SKIP) ⇒ SubscriptionComponentSubscription

Returns a new instance of SubscriptionComponentSubscription.



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

def initialize(state = SKIP, updated_at = SKIP)
  @state = state unless state == SKIP
  @updated_at = updated_at unless updated_at == SKIP
end

Instance Attribute Details

#stateString

TODO: Write general description for this method

Returns:

  • (String)


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

def state
  @state
end

#updated_atString

TODO: Write general description for this method

Returns:

  • (String)


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

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/advanced_billing/models/subscription_component_subscription.rb', line 48

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  state = hash.key?('state') ? hash['state'] : SKIP
  updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP

  # Create object from extracted values.
  SubscriptionComponentSubscription.new(state,
                                        updated_at)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/advanced_billing/models/subscription_component_subscription.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['state'] = 'state'
  @_hash['updated_at'] = 'updated_at'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/advanced_billing/models/subscription_component_subscription.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
35
# File 'lib/advanced_billing/models/subscription_component_subscription.rb', line 30

def self.optionals
  %w[
    state
    updated_at
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



62
63
64
65
66
67
68
# File 'lib/advanced_billing/models/subscription_component_subscription.rb', line 62

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end