Class: StickyIoRestfulApiV2025731::PrepaidProfileData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb

Overview

PrepaidProfileData 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(is_subscription:, is_cancel_immediate:, is_refund_allowed:, is_initial_shipping_on_restart:, created_at:, updated_at:, terms:, additional_properties: nil) ⇒ PrepaidProfileData

Returns a new instance of PrepaidProfileData.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 64

def initialize(is_subscription:, is_cancel_immediate:, is_refund_allowed:,
               is_initial_shipping_on_restart:, created_at:, updated_at:,
               terms:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @is_subscription = is_subscription
  @is_cancel_immediate = is_cancel_immediate
  @is_refund_allowed = is_refund_allowed
  @is_initial_shipping_on_restart = is_initial_shipping_on_restart
  @created_at = created_at
  @updated_at = updated_at
  @terms = terms
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 30

def created_at
  @created_at
end

#is_cancel_immediateInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 18

def is_cancel_immediate
  @is_cancel_immediate
end

#is_initial_shipping_on_restartInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 26

def is_initial_shipping_on_restart
  @is_initial_shipping_on_restart
end

#is_refund_allowedInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 22

def is_refund_allowed
  @is_refund_allowed
end

#is_subscriptionInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 14

def is_subscription
  @is_subscription
end

#termsArray[Term]

TODO: Write general description for this method

Returns:



38
39
40
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 38

def terms
  @terms
end

#updated_atString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 34

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
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
122
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  is_subscription =
    hash.key?('is_subscription') ? hash['is_subscription'] : nil
  is_cancel_immediate =
    hash.key?('is_cancel_immediate') ? hash['is_cancel_immediate'] : nil
  is_refund_allowed =
    hash.key?('is_refund_allowed') ? hash['is_refund_allowed'] : nil
  is_initial_shipping_on_restart =
    hash.key?('is_initial_shipping_on_restart') ? hash['is_initial_shipping_on_restart'] : nil
  created_at = hash.key?('created_at') ? hash['created_at'] : nil
  updated_at = hash.key?('updated_at') ? hash['updated_at'] : nil
  # Parameter is an array, so we need to iterate through it
  terms = nil
  unless hash['terms'].nil?
    terms = []
    hash['terms'].each do |structure|
      terms << (Term.from_hash(structure) if structure)
    end
  end

  terms = nil unless hash.key?('terms')

  # 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.
  PrepaidProfileData.new(is_subscription: is_subscription,
                         is_cancel_immediate: is_cancel_immediate,
                         is_refund_allowed: is_refund_allowed,
                         is_initial_shipping_on_restart: is_initial_shipping_on_restart,
                         created_at: created_at,
                         updated_at: updated_at,
                         terms: terms,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['is_subscription'] = 'is_subscription'
  @_hash['is_cancel_immediate'] = 'is_cancel_immediate'
  @_hash['is_refund_allowed'] = 'is_refund_allowed'
  @_hash['is_initial_shipping_on_restart'] =
    'is_initial_shipping_on_restart'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['terms'] = 'terms'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 55

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
142
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} is_subscription: #{@is_subscription.inspect}, is_cancel_immediate:"\
  " #{@is_cancel_immediate.inspect}, is_refund_allowed: #{@is_refund_allowed.inspect},"\
  " is_initial_shipping_on_restart: #{@is_initial_shipping_on_restart.inspect}, created_at:"\
  " #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, terms: #{@terms.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
131
132
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile_data.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} is_subscription: #{@is_subscription}, is_cancel_immediate:"\
  " #{@is_cancel_immediate}, is_refund_allowed: #{@is_refund_allowed},"\
  " is_initial_shipping_on_restart: #{@is_initial_shipping_on_restart}, created_at:"\
  " #{@created_at}, updated_at: #{@updated_at}, terms: #{@terms}, additional_properties:"\
  " #{@additional_properties}>"
end