Class: ApiReference::SubscriptionChangeListResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/subscription_change_list_response.rb

Overview

SubscriptionChangeListResponse 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(id:, status:, expiration_time:, subscription_id:, applied_at: SKIP, cancelled_at: SKIP, additional_properties: nil) ⇒ SubscriptionChangeListResponse

Returns a new instance of SubscriptionChangeListResponse.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 68

def initialize(id:, status:, expiration_time:, subscription_id:,
               applied_at: SKIP, cancelled_at: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @status = status
  @applied_at = applied_at unless applied_at == SKIP
  @cancelled_at = cancelled_at unless cancelled_at == SKIP
  @expiration_time = expiration_time
  @subscription_id = subscription_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#applied_atDateTime

When this change was applied.

Returns:

  • (DateTime)


23
24
25
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 23

def applied_at
  @applied_at
end

#cancelled_atDateTime

When this change was cancelled.

Returns:

  • (DateTime)


27
28
29
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 27

def cancelled_at
  @cancelled_at
end

#expiration_timeDateTime

Subscription change will be cancelled at this time and can no longer be applied.

Returns:

  • (DateTime)


32
33
34
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 32

def expiration_time
  @expiration_time
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 15

def id
  @id
end

#statusStatus12

TODO: Write general description for this method

Returns:



19
20
21
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 19

def status
  @status
end

#subscription_idString

Subscription change will be cancelled at this time and can no longer be applied.

Returns:

  • (String)


37
38
39
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 37

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
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
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  expiration_time = if hash.key?('expiration_time')
                      (DateTimeHelper.from_rfc3339(hash['expiration_time']) if hash['expiration_time'])
                    end
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : nil
  applied_at = if hash.key?('applied_at')
                 (DateTimeHelper.from_rfc3339(hash['applied_at']) if hash['applied_at'])
               else
                 SKIP
               end
  cancelled_at = if hash.key?('cancelled_at')
                   (DateTimeHelper.from_rfc3339(hash['cancelled_at']) if hash['cancelled_at'])
                 else
                   SKIP
                 end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  SubscriptionChangeListResponse.new(id: id,
                                     status: status,
                                     expiration_time: expiration_time,
                                     subscription_id: subscription_id,
                                     applied_at: applied_at,
                                     cancelled_at: cancelled_at,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['status'] = 'status'
  @_hash['applied_at'] = 'applied_at'
  @_hash['cancelled_at'] = 'cancelled_at'
  @_hash['expiration_time'] = 'expiration_time'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
63
64
65
66
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 60

def self.nullables
  %w[
    applied_at
    cancelled_at
    subscription_id
  ]
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 52

def self.optionals
  %w[
    applied_at
    cancelled_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



144
145
146
147
148
149
150
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 144

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, status: #{@status.inspect}, applied_at:"\
  " #{@applied_at.inspect}, cancelled_at: #{@cancelled_at.inspect}, expiration_time:"\
  " #{@expiration_time.inspect}, subscription_id: #{@subscription_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_applied_atObject



123
124
125
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 123

def to_custom_applied_at
  DateTimeHelper.to_rfc3339(applied_at)
end

#to_custom_cancelled_atObject



127
128
129
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 127

def to_custom_cancelled_at
  DateTimeHelper.to_rfc3339(cancelled_at)
end

#to_custom_expiration_timeObject



131
132
133
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 131

def to_custom_expiration_time
  DateTimeHelper.to_rfc3339(expiration_time)
end

#to_sObject

Provides a human-readable string representation of the object.



136
137
138
139
140
141
# File 'lib/api_reference/models/subscription_change_list_response.rb', line 136

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, status: #{@status}, applied_at: #{@applied_at}, cancelled_at:"\
  " #{@cancelled_at}, expiration_time: #{@expiration_time}, subscription_id:"\
  " #{@subscription_id}, additional_properties: #{@additional_properties}>"
end