Class: Fugle::Intraday::Meta Private
- Inherits:
-
Object
- Object
- Fugle::Intraday::Meta
- Defined in:
- lib/fugle/intraday/meta.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 Meta
Defined Under Namespace
Classes: 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.
%w[Index Terminated Suspended Warrant].freeze
- PERMITS =
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.
%w[DayBuySell DaySellBuy ShortMargin ShortLend].freeze
Constants included from HTTP::API
HTTP::API::ENDPOINT, HTTP::API::VERSION
Instance Attribute Summary collapse
- #industry ⇒ Object readonly private
- #name ⇒ Object readonly private
- #price ⇒ Object readonly private
- #type ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(data) ⇒ Meta
constructor
private
A new instance of Meta.
-
#to_h ⇒ Hash
private
Convert to Hash.
-
#to_json(*args) ⇒ String
private
Convert to JSON.
Methods included from HTTP::API
Constructor Details
#initialize(data) ⇒ Meta
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 Meta.
28 29 30 31 32 33 34 35 36 |
# File 'lib/fugle/intraday/meta.rb', line 28 def initialize(data) load_boolean STATES, data, prefix: 'is' load_boolean PERMITS, data, prefix: 'can' @name = data['nameZhTw'] @industry = data['industryZhTw'] @type = data['typeZhTw'] @price = Price.new(data) end |
Instance Attribute Details
#industry ⇒ Object (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.
19 20 21 |
# File 'lib/fugle/intraday/meta.rb', line 19 def industry @industry end |
#name ⇒ Object (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.
19 20 21 |
# File 'lib/fugle/intraday/meta.rb', line 19 def name @name end |
#price ⇒ Object (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.
19 20 21 |
# File 'lib/fugle/intraday/meta.rb', line 19 def price @price end |
#type ⇒ Object (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.
19 20 21 |
# File 'lib/fugle/intraday/meta.rb', line 19 def type @type end |
Instance Method Details
#to_h ⇒ Hash
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
rubocop:disable Metrics/MethodLength
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fugle/intraday/meta.rb', line 61 def to_h { name: @name, industry: @industry, type: @type, price: @price, is_index: index?, is_terminated: terminated?, is_suspended: suspended?, is_warrant: warrant?, can_day_buy_sell: day_buy_sell?, can_day_sell_buy: day_sell_buy?, can_short_margin: short_margin?, can_short_lend: short_lend? } 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
85 86 87 |
# File 'lib/fugle/intraday/meta.rb', line 85 def to_json(*args) to_h.to_json(*args) end |