Class: StickyIoRestfulApiV2025731::Currency

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

Overview

Currency 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(title:, code:, symbol_left:, symbol_right:, decimal_point:, thousands_point:, decimal_places:, html_entity_name:, id:, additional_properties: nil) ⇒ Currency

Returns a new instance of Currency.



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/currency.rb', line 73

def initialize(title:, code:, symbol_left:, symbol_right:, decimal_point:,
               thousands_point:, decimal_places:, html_entity_name:, id:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @title = title
  @code = code
  @symbol_left = symbol_left
  @symbol_right = symbol_right
  @decimal_point = decimal_point
  @thousands_point = thousands_point
  @decimal_places = decimal_places
  @html_entity_name = html_entity_name
  @id = id
  @additional_properties = additional_properties
end

Instance Attribute Details

#codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def code
  @code
end

#decimal_placesInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def decimal_places
  @decimal_places
end

#decimal_pointString

TODO: Write general description for this method

Returns:

  • (String)


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

def decimal_point
  @decimal_point
end

#html_entity_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def html_entity_name
  @html_entity_name
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#symbol_leftString

TODO: Write general description for this method

Returns:

  • (String)


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

def symbol_left
  @symbol_left
end

#symbol_rightString

TODO: Write general description for this method

Returns:

  • (String)


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

def symbol_right
  @symbol_right
end

#thousands_pointString

TODO: Write general description for this method

Returns:

  • (String)


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

def thousands_point
  @thousands_point
end

#titleString

TODO: Write general description for this method

Returns:

  • (String)


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

def title
  @title
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/currency.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  title = hash.key?('title') ? hash['title'] : nil
  code = hash.key?('code') ? hash['code'] : nil
  symbol_left = hash.key?('symbol_left') ? hash['symbol_left'] : nil
  symbol_right = hash.key?('symbol_right') ? hash['symbol_right'] : nil
  decimal_point = hash.key?('decimal_point') ? hash['decimal_point'] : nil
  thousands_point =
    hash.key?('thousands_point') ? hash['thousands_point'] : nil
  decimal_places =
    hash.key?('decimal_places') ? hash['decimal_places'] : nil
  html_entity_name =
    hash.key?('html_entity_name') ? hash['html_entity_name'] : nil
  id = hash.key?('id') ? hash['id'] : 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.
  Currency.new(title: title,
               code: code,
               symbol_left: symbol_left,
               symbol_right: symbol_right,
               decimal_point: decimal_point,
               thousands_point: thousands_point,
               decimal_places: decimal_places,
               html_entity_name: html_entity_name,
               id: id,
               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/currency.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['title'] = 'title'
  @_hash['code'] = 'code'
  @_hash['symbol_left'] = 'symbol_left'
  @_hash['symbol_right'] = 'symbol_right'
  @_hash['decimal_point'] = 'decimal_point'
  @_hash['thousands_point'] = 'thousands_point'
  @_hash['decimal_places'] = 'decimal_places'
  @_hash['html_entity_name'] = 'html_entity_name'
  @_hash['id'] = 'id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Currency | Hash)

    value against the validation is performed.



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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/sticky_io_restful_api_v2025731/models/currency.rb', line 131

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.title,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.code,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.symbol_left,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.symbol_right,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.decimal_point,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.thousands_point,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.decimal_places,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.html_entity_name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.id,
                              ->(val) { val.instance_of? Integer })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['title'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['code'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['symbol_left'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['symbol_right'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['decimal_point'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['thousands_point'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['decimal_places'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['html_entity_name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['id'],
                            ->(val) { val.instance_of? Integer })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



189
190
191
192
193
194
195
196
# File 'lib/sticky_io_restful_api_v2025731/models/currency.rb', line 189

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} title: #{@title.inspect}, code: #{@code.inspect}, symbol_left:"\
  " #{@symbol_left.inspect}, symbol_right: #{@symbol_right.inspect}, decimal_point:"\
  " #{@decimal_point.inspect}, thousands_point: #{@thousands_point.inspect}, decimal_places:"\
  " #{@decimal_places.inspect}, html_entity_name: #{@html_entity_name.inspect}, id:"\
  " #{@id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



180
181
182
183
184
185
186
# File 'lib/sticky_io_restful_api_v2025731/models/currency.rb', line 180

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} title: #{@title}, code: #{@code}, symbol_left: #{@symbol_left},"\
  " symbol_right: #{@symbol_right}, decimal_point: #{@decimal_point}, thousands_point:"\
  " #{@thousands_point}, decimal_places: #{@decimal_places}, html_entity_name:"\
  " #{@html_entity_name}, id: #{@id}, additional_properties: #{@additional_properties}>"
end