Class: Fugle::Intraday::Quote Private

Inherits:
Object
  • Object
show all
Includes:
HTTP::API, Utils
Defined in:
lib/fugle/intraday/quote.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.

The Intraday Quote

Since:

  • 0.1.0

Defined Under Namespace

Classes: Order, Price

Constant Summary collapse

STATES =

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

Since:

  • 0.1.0

%w[Curbing Trial OpenDelayed Halting Closed].freeze

Constants included from HTTP::API

HTTP::API::ENDPOINT, HTTP::API::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HTTP::API

included

Constructor Details

#initialize(data) ⇒ Quote

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 Quote.

Since:

  • 0.1.0



30
31
32
33
34
35
36
37
38
# File 'lib/fugle/intraday/quote.rb', line 30

def initialize(data)
  load_boolean STATES, data, prefix: 'is'

  @total = Trade.new(data['total'])
  @trial = Trade.new(data['trial'])
  @trade = Trade.new(data['trade'])
  @price = Price.new(data)
  @order = Order.new(data['order'])
end

Instance Attribute Details

#ordersObject (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



22
23
24
# File 'lib/fugle/intraday/quote.rb', line 22

def orders
  @orders
end

#priceObject (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



22
23
24
# File 'lib/fugle/intraday/quote.rb', line 22

def price
  @price
end

#totalObject (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



22
23
24
# File 'lib/fugle/intraday/quote.rb', line 22

def total
  @total
end

#tradeObject (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



22
23
24
# File 'lib/fugle/intraday/quote.rb', line 22

def trade
  @trade
end

#trialObject (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



22
23
24
# File 'lib/fugle/intraday/quote.rb', line 22

def trial
  @trial
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



54
55
56
57
58
59
60
61
62
# File 'lib/fugle/intraday/quote.rb', line 54

def to_h
  {
    total: @total,
    trial: @trial,
    trade: @trade,
    price: @price,
    order: @order
  }
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



70
71
72
# File 'lib/fugle/intraday/quote.rb', line 70

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