Class: MoexIssClient::Client
- Inherits:
-
Object
- Object
- MoexIssClient::Client
- Defined in:
- lib/moex_iss_client/client.rb
Constant Summary collapse
- ROOT_ENDPOINT =
'https://iss.moex.com/iss'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #history(sec_id, options = {}) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/moex_iss_client/client.rb', line 11 def initialize @client = Faraday.new( url: ROOT_ENDPOINT, headers: { 'Content-Type' => 'application/xml' } ) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
9 10 11 |
# File 'lib/moex_iss_client/client.rb', line 9 def client @client end |
Instance Method Details
#history(sec_id, options = {}) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/moex_iss_client/client.rb', line 18 def history(sec_id, = {}) raise ArgumentError, 'Invalid security ID' if sec_id.to_s.empty? params = history_params(sec_id, ) client.get(params[:path], { from: params[:from], till: params[:till] }).body end |