Class: StickyIoRestfulApiV2025731::PrepaidProfile

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

Overview

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

Returns a new instance of PrepaidProfile.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile.rb', line 74

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

  @is_subscription = is_subscription unless is_subscription == SKIP
  @is_cancel_immediate = is_cancel_immediate unless is_cancel_immediate == SKIP
  @is_refund_allowed = is_refund_allowed unless is_refund_allowed == SKIP
  unless is_initial_shipping_on_restart == SKIP
    @is_initial_shipping_on_restart =
      is_initial_shipping_on_restart
  end
  @created_at = created_at unless created_at == SKIP
  @updated_at = updated_at unless updated_at == SKIP
  @terms = terms unless terms == SKIP
  @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.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.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.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.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.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.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.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.



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
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  is_subscription =
    hash.key?('is_subscription') ? hash['is_subscription'] : SKIP
  is_cancel_immediate =
    hash.key?('is_cancel_immediate') ? hash['is_cancel_immediate'] : SKIP
  is_refund_allowed =
    hash.key?('is_refund_allowed') ? hash['is_refund_allowed'] : SKIP
  is_initial_shipping_on_restart =
    hash.key?('is_initial_shipping_on_restart') ? hash['is_initial_shipping_on_restart'] : SKIP
  created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
  updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP
  # 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 = SKIP 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.
  PrepaidProfile.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.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



68
69
70
71
72
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile.rb', line 68

def self.nullables
  %w[
    updated_at
  ]
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile.rb', line 55

def self.optionals
  %w[
    is_subscription
    is_cancel_immediate
    is_refund_allowed
    is_initial_shipping_on_restart
    created_at
    updated_at
    terms
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (PrepaidProfile | Hash)

    value against the validation is performed.



140
141
142
143
144
145
146
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile.rb', line 140

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

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



159
160
161
162
163
164
165
166
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile.rb', line 159

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.



149
150
151
152
153
154
155
156
# File 'lib/sticky_io_restful_api_v2025731/models/prepaid_profile.rb', line 149

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