Class: StickyIoRestfulApiV2025731::DataGetShippingMethods

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

Overview

DataGetShippingMethods 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(freight_code:, threshold_amount:, threshold_charge_amount:, id:, name:, description:, amount_trial:, amount_recurring:, type:, service_code:, created_at:, updated_at:, additional_properties: nil) ⇒ DataGetShippingMethods

Returns a new instance of DataGetShippingMethods.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 91

def initialize(freight_code:, threshold_amount:, threshold_charge_amount:,
               id:, name:, description:, amount_trial:, amount_recurring:,
               type:, service_code:, created_at:, updated_at:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @freight_code = freight_code
  @threshold_amount = threshold_amount
  @threshold_charge_amount = threshold_charge_amount
  @id = id
  @name = name
  @description = description
  @amount_trial = amount_trial
  @amount_recurring = amount_recurring
  @type = type
  @service_code = service_code
  @created_at = created_at
  @updated_at = updated_at
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_recurringString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 42

def amount_recurring
  @amount_recurring
end

#amount_trialString

TODO: Write general description for this method

Returns:

  • (String)


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

def amount_trial
  @amount_trial
end

#created_atCreatedAt

TODO: Write general description for this method

Returns:



54
55
56
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 54

def created_at
  @created_at
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#freight_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def freight_code
  @freight_code
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#service_codeString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 50

def service_code
  @service_code
end

#threshold_amountString

TODO: Write general description for this method

Returns:

  • (String)


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

def threshold_amount
  @threshold_amount
end

#threshold_charge_amountString

TODO: Write general description for this method

Returns:

  • (String)


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

def threshold_charge_amount
  @threshold_charge_amount
end

#typeTypeData1

TODO: Write general description for this method

Returns:



46
47
48
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 46

def type
  @type
end

#updated_atObject

TODO: Write general description for this method

Returns:

  • (Object)


58
59
60
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 58

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
157
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 114

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  freight_code = hash.key?('freight_code') ? hash['freight_code'] : nil
  threshold_amount =
    hash.key?('threshold_amount') ? hash['threshold_amount'] : nil
  threshold_charge_amount =
    hash.key?('threshold_charge_amount') ? hash['threshold_charge_amount'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  amount_trial = hash.key?('amount_trial') ? hash['amount_trial'] : nil
  amount_recurring =
    hash.key?('amount_recurring') ? hash['amount_recurring'] : nil
  type = TypeData1.from_hash(hash['type']) if hash['type']
  service_code = hash.key?('service_code') ? hash['service_code'] : nil
  created_at = CreatedAt.from_hash(hash['created_at']) if hash['created_at']
  updated_at = hash.key?('updated_at') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DataGetShippingMethodsUpdatedAt), hash['updated_at']
  ) : nil

  # 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.
  DataGetShippingMethods.new(freight_code: freight_code,
                             threshold_amount: threshold_amount,
                             threshold_charge_amount: threshold_charge_amount,
                             id: id,
                             name: name,
                             description: description,
                             amount_trial: amount_trial,
                             amount_recurring: amount_recurring,
                             type: type,
                             service_code: service_code,
                             created_at: created_at,
                             updated_at: updated_at,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['freight_code'] = 'freight_code'
  @_hash['threshold_amount'] = 'threshold_amount'
  @_hash['threshold_charge_amount'] = 'threshold_charge_amount'
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['description'] = 'description'
  @_hash['amount_trial'] = 'amount_trial'
  @_hash['amount_recurring'] = 'amount_recurring'
  @_hash['type'] = 'type'
  @_hash['service_code'] = 'service_code'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash
end

.nullablesObject

An array for nullable fields



84
85
86
87
88
89
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 84

def self.nullables
  %w[
    threshold_amount
    threshold_charge_amount
  ]
end

.optionalsObject

An array for optional fields



79
80
81
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 79

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
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
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 161

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.freight_code,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.threshold_amount,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.threshold_charge_amount,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.description,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.amount_trial,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.amount_recurring,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { TypeData1.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.service_code,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { CreatedAt.validate(val) },
                              is_model_hash: true) and
        UnionTypeLookUp.get(:DataGetShippingMethodsUpdatedAt)
                       .validate(value.updated_at)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['freight_code'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['threshold_amount'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['threshold_charge_amount'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['description'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['amount_trial'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['amount_recurring'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { TypeData1.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['service_code'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { CreatedAt.validate(val) },
                            is_model_hash: true) and
      UnionTypeLookUp.get(:DataGetShippingMethodsUpdatedAt)
                     .validate(value['updated_at'])
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



237
238
239
240
241
242
243
244
245
246
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 237

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} freight_code: #{@freight_code.inspect}, threshold_amount:"\
  " #{@threshold_amount.inspect}, threshold_charge_amount:"\
  " #{@threshold_charge_amount.inspect}, id: #{@id.inspect}, name: #{@name.inspect},"\
  " description: #{@description.inspect}, amount_trial: #{@amount_trial.inspect},"\
  " amount_recurring: #{@amount_recurring.inspect}, type: #{@type.inspect}, service_code:"\
  " #{@service_code.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
  " #{@updated_at.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



226
227
228
229
230
231
232
233
234
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_shipping_methods.rb', line 226

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} freight_code: #{@freight_code}, threshold_amount: #{@threshold_amount},"\
  " threshold_charge_amount: #{@threshold_charge_amount}, id: #{@id}, name: #{@name},"\
  " description: #{@description}, amount_trial: #{@amount_trial}, amount_recurring:"\
  " #{@amount_recurring}, type: #{@type}, service_code: #{@service_code}, created_at:"\
  " #{@created_at}, updated_at: #{@updated_at}, additional_properties:"\
  " #{@additional_properties}>"
end