Class: FinnhubRuby::UsaSpending

Inherits:
Object
  • Object
show all
Defined in:
lib/finnhub_ruby/models/usa_spending.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UsaSpending

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 143

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FinnhubRuby::UsaSpending` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `FinnhubRuby::UsaSpending`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'symbol')
    self.symbol = attributes[:'symbol']
  end

  if attributes.key?(:'recipient_name')
    self.recipient_name = attributes[:'recipient_name']
  end

  if attributes.key?(:'recipient_parent_name')
    self.recipient_parent_name = attributes[:'recipient_parent_name']
  end

  if attributes.key?(:'award_description')
    self.award_description = attributes[:'award_description']
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'action_date')
    self.action_date = attributes[:'action_date']
  end

  if attributes.key?(:'total_value')
    self.total_value = attributes[:'total_value']
  end

  if attributes.key?(:'performance_start_date')
    self.performance_start_date = attributes[:'performance_start_date']
  end

  if attributes.key?(:'performance_end_date')
    self.performance_end_date = attributes[:'performance_end_date']
  end

  if attributes.key?(:'awarding_agency_name')
    self.awarding_agency_name = attributes[:'awarding_agency_name']
  end

  if attributes.key?(:'awarding_sub_agency_name')
    self.awarding_sub_agency_name = attributes[:'awarding_sub_agency_name']
  end

  if attributes.key?(:'awarding_office_name')
    self.awarding_office_name = attributes[:'awarding_office_name']
  end

  if attributes.key?(:'performance_country')
    self.performance_country = attributes[:'performance_country']
  end

  if attributes.key?(:'performance_city')
    self.performance_city = attributes[:'performance_city']
  end

  if attributes.key?(:'performance_county')
    self.performance_county = attributes[:'performance_county']
  end

  if attributes.key?(:'performance_state')
    self.performance_state = attributes[:'performance_state']
  end

  if attributes.key?(:'performance_zip_code')
    self.performance_zip_code = attributes[:'performance_zip_code']
  end

  if attributes.key?(:'performance_congressional_district')
    self.performance_congressional_district = attributes[:'performance_congressional_district']
  end

  if attributes.key?(:'naics_code')
    self.naics_code = attributes[:'naics_code']
  end

  if attributes.key?(:'permalink')
    self.permalink = attributes[:'permalink']
  end
end

Instance Attribute Details

#action_dateObject

Period.



34
35
36
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 34

def action_date
  @action_date
end

#award_descriptionObject

Description.



28
29
30
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 28

def award_description
  @award_description
end

#awarding_agency_nameObject

Award agency.



46
47
48
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 46

def awarding_agency_name
  @awarding_agency_name
end

#awarding_office_nameObject

Award office name.



52
53
54
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 52

def awarding_office_name
  @awarding_office_name
end

#awarding_sub_agency_nameObject

Award sub-agency.



49
50
51
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 49

def awarding_sub_agency_name
  @awarding_sub_agency_name
end

#countryObject

Recipient’s country.



31
32
33
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 31

def country
  @country
end

#naics_codeObject

NAICS code.



73
74
75
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 73

def naics_code
  @naics_code
end

#performance_cityObject

Performance city.



58
59
60
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 58

def performance_city
  @performance_city
end

#performance_congressional_districtObject

Performance congressional district.



70
71
72
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 70

def performance_congressional_district
  @performance_congressional_district
end

#performance_countryObject

Performance country.



55
56
57
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 55

def performance_country
  @performance_country
end

#performance_countyObject

Performance county.



61
62
63
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 61

def performance_county
  @performance_county
end

#performance_end_dateObject

Performance end date.



43
44
45
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 43

def performance_end_date
  @performance_end_date
end

#performance_start_dateObject

Performance start date.



40
41
42
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 40

def performance_start_date
  @performance_start_date
end

#performance_stateObject

Performance state.



64
65
66
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 64

def performance_state
  @performance_state
end

#performance_zip_codeObject

Performance zip code.



67
68
69
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 67

def performance_zip_code
  @performance_zip_code
end

Permalink.



76
77
78
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 76

def permalink
  @permalink
end

#recipient_nameObject

Company’s name.



22
23
24
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 22

def recipient_name
  @recipient_name
end

#recipient_parent_nameObject

Company’s name.



25
26
27
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 25

def recipient_parent_name
  @recipient_parent_name
end

#symbolObject

Symbol.



19
20
21
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 19

def symbol
  @symbol
end

#total_valueObject

Income reported by lobbying firms.



37
38
39
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 37

def total_value
  @total_value
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



105
106
107
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 105

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 79

def self.attribute_map
  {
    :'symbol' => :'symbol',
    :'recipient_name' => :'recipientName',
    :'recipient_parent_name' => :'recipientParentName',
    :'award_description' => :'awardDescription',
    :'country' => :'country',
    :'action_date' => :'actionDate',
    :'total_value' => :'totalValue',
    :'performance_start_date' => :'performanceStartDate',
    :'performance_end_date' => :'performanceEndDate',
    :'awarding_agency_name' => :'awardingAgencyName',
    :'awarding_sub_agency_name' => :'awardingSubAgencyName',
    :'awarding_office_name' => :'awardingOfficeName',
    :'performance_country' => :'performanceCountry',
    :'performance_city' => :'performanceCity',
    :'performance_county' => :'performanceCounty',
    :'performance_state' => :'performanceState',
    :'performance_zip_code' => :'performanceZipCode',
    :'performance_congressional_district' => :'performanceCongressionalDistrict',
    :'naics_code' => :'naicsCode',
    :'permalink' => :'permalink'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



292
293
294
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 292

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



136
137
138
139
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 136

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 110

def self.openapi_types
  {
    :'symbol' => :'String',
    :'recipient_name' => :'String',
    :'recipient_parent_name' => :'String',
    :'award_description' => :'String',
    :'country' => :'String',
    :'action_date' => :'String',
    :'total_value' => :'Float',
    :'performance_start_date' => :'String',
    :'performance_end_date' => :'String',
    :'awarding_agency_name' => :'String',
    :'awarding_sub_agency_name' => :'String',
    :'awarding_office_name' => :'String',
    :'performance_country' => :'String',
    :'performance_city' => :'String',
    :'performance_county' => :'String',
    :'performance_state' => :'String',
    :'performance_zip_code' => :'String',
    :'performance_congressional_district' => :'String',
    :'naics_code' => :'String',
    :'permalink' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 252

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      symbol == o.symbol &&
      recipient_name == o.recipient_name &&
      recipient_parent_name == o.recipient_parent_name &&
      award_description == o.award_description &&
      country == o.country &&
      action_date == o.action_date &&
      total_value == o.total_value &&
      performance_start_date == o.performance_start_date &&
      performance_end_date == o.performance_end_date &&
      awarding_agency_name == o.awarding_agency_name &&
      awarding_sub_agency_name == o.awarding_sub_agency_name &&
      awarding_office_name == o.awarding_office_name &&
      performance_country == o.performance_country &&
      performance_city == o.performance_city &&
      performance_county == o.performance_county &&
      performance_state == o.performance_state &&
      performance_zip_code == o.performance_zip_code &&
      performance_congressional_district == o.performance_congressional_district &&
      naics_code == o.naics_code &&
      permalink == o.permalink
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 322

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = FinnhubRuby.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 393

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 299

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


279
280
281
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 279

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



285
286
287
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 285

def hash
  [symbol, recipient_name, recipient_parent_name, award_description, country, action_date, total_value, performance_start_date, performance_end_date, awarding_agency_name, awarding_sub_agency_name, awarding_office_name, performance_country, performance_city, performance_county, performance_state, performance_zip_code, performance_congressional_district, naics_code, permalink].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



239
240
241
242
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 239

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



369
370
371
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 369

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 375

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



363
364
365
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 363

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



246
247
248
# File 'lib/finnhub_ruby/models/usa_spending.rb', line 246

def valid?
  true
end