Class: Finnhub::Economic_Code

Inherits:
Object
  • Object
show all
Defined in:
lib/Economic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, code:, hash:) ⇒ Economic_Code

Returns a new instance of Economic_Code.



3
4
5
6
7
# File 'lib/Economic.rb', line 3

def initialize(client:, code:, hash:)
  @client = client
  @code = code
  @hash = hash
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



9
10
11
# File 'lib/Economic.rb', line 9

def code
  @code
end

#hashObject (readonly)

Returns the value of attribute hash.



9
10
11
# File 'lib/Economic.rb', line 9

def hash
  @hash
end

Instance Method Details

#data(plain: false) ⇒ Object



11
12
13
14
15
16
# File 'lib/Economic.rb', line 11

def data(plain: false)
  output = @client.request("/economic?code=#{@code}")
  return output if plain

  output.map{|o| [Time.parse(o[0]), o[1]]}
end