Class: StickyIoRestfulApiV2025731::CreateShippingMethodRequest

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

Overview

CreateShippingMethodRequest 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(name:, type_id:, service_code:, freight_code:, description:, amount_trial:, amount_recurring:, threshold_amount:, threshold_charge_amount:, additional_properties: nil) ⇒ CreateShippingMethodRequest

Returns a new instance of CreateShippingMethodRequest.



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

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

  @name = name
  @type_id = type_id
  @service_code = service_code
  @freight_code = freight_code
  @description = description
  @amount_trial = amount_trial
  @amount_recurring = amount_recurring
  @threshold_amount = threshold_amount
  @threshold_charge_amount = threshold_charge_amount
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_recurringInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def amount_recurring
  @amount_recurring
end

#amount_trialInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def amount_trial
  @amount_trial
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#freight_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def freight_code
  @freight_code
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#service_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def service_code
  @service_code
end

#threshold_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


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

def threshold_amount
  @threshold_amount
end

#threshold_charge_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


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

def threshold_charge_amount
  @threshold_charge_amount
end

#type_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def type_id
  @type_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
123
124
125
126
127
# File 'lib/sticky_io_restful_api_v2025731/models/create_shipping_method_request.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  type_id = hash.key?('type_id') ? hash['type_id'] : nil
  service_code = hash.key?('service_code') ? hash['service_code'] : nil
  freight_code = hash.key?('freight_code') ? hash['freight_code'] : 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
  threshold_amount =
    hash.key?('threshold_amount') ? hash['threshold_amount'] : nil
  threshold_charge_amount =
    hash.key?('threshold_charge_amount') ? hash['threshold_charge_amount'] : 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.
  CreateShippingMethodRequest.new(name: name,
                                  type_id: type_id,
                                  service_code: service_code,
                                  freight_code: freight_code,
                                  description: description,
                                  amount_trial: amount_trial,
                                  amount_recurring: amount_recurring,
                                  threshold_amount: threshold_amount,
                                  threshold_charge_amount: threshold_charge_amount,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sticky_io_restful_api_v2025731/models/create_shipping_method_request.rb', line 49

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

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/sticky_io_restful_api_v2025731/models/create_shipping_method_request.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
# File 'lib/sticky_io_restful_api_v2025731/models/create_shipping_method_request.rb', line 64

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
136
137
# File 'lib/sticky_io_restful_api_v2025731/models/create_shipping_method_request.rb', line 130

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