Class: Fugle::Intraday::Chart::Item Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fugle/intraday/chart.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes, time) ⇒ Item

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Item.

Since:

  • 0.1.0



51
52
53
54
55
56
# File 'lib/fugle/intraday/chart.rb', line 51

def initialize(attributes, time)
  @time = DateTime.parse(time)
  attributes.each do |name, value|
    instance_variable_set("@#{name}", value)
  end
end

Instance Attribute Details

#closeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/intraday/chart.rb', line 47

def close
  @close
end

#highObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/intraday/chart.rb', line 47

def high
  @high
end

#lowObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/intraday/chart.rb', line 47

def low
  @low
end

#openObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/intraday/chart.rb', line 47

def open
  @open
end

#timeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/intraday/chart.rb', line 47

def time
  @time
end

#unitObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/intraday/chart.rb', line 47

def unit
  @unit
end

#volumeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/intraday/chart.rb', line 47

def volume
  @volume
end

Instance Method Details

#to_hHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Convert to Hash

Returns:

  • (Hash)

    the response as hash

Since:

  • 0.1.0



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/fugle/intraday/chart.rb', line 64

def to_h
  {
    open: @open,
    high: @high,
    low: @low,
    close: @close,
    unit: @unit,
    volume: @volume,
    time: @time
  }
end

#to_json(*args) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Convert to JSON

Returns:

  • (String)

    the json string

Since:

  • 0.1.0



82
83
84
# File 'lib/fugle/intraday/chart.rb', line 82

def to_json(*args)
  to_h.to_json(*args)
end