Module: HG::Finance
- Defined in:
- lib/hg/finance.rb,
lib/hg/finance/data.rb,
lib/hg/finance/stock.rb,
lib/hg/finance/taxes.rb,
lib/hg/finance/locale.rb,
lib/hg/finance/version.rb,
lib/hg/finance/currency.rb
Defined Under Namespace
Classes: Currency, Data, Locale, Stock, Taxes
Constant Summary collapse
- HOST_NAME =
'://api.hgbrasil.com/finance'
- VERSION =
"1.0.0"
Class Attribute Summary collapse
-
.api_key ⇒ Object
API Key.
-
.api_key_status ⇒ Object
readonly
API Key status.
-
.locale ⇒ Object
Locale.
-
.use_rails_cache ⇒ Object
Use Rails cache for recieved data (realy recommended).
-
.use_ssl ⇒ Object
Use SSL to access the API.
Class Method Summary collapse
- .defaults ⇒ Object
- .get(options = {}) ⇒ Object
- .process(params) ⇒ Object
- .setup {|_self| ... } ⇒ Object
Class Attribute Details
.api_key ⇒ Object
API Key
13 14 15 |
# File 'lib/hg/finance.rb', line 13 def api_key @api_key end |
.api_key_status ⇒ Object (readonly)
API Key status
19 20 21 |
# File 'lib/hg/finance.rb', line 19 def api_key_status @api_key_status end |
.locale ⇒ Object
Locale
16 17 18 |
# File 'lib/hg/finance.rb', line 16 def locale @locale end |
.use_rails_cache ⇒ Object
Use Rails cache for recieved data (realy recommended)
25 26 27 |
# File 'lib/hg/finance.rb', line 25 def use_rails_cache @use_rails_cache end |
.use_ssl ⇒ Object
Use SSL to access the API
22 23 24 |
# File 'lib/hg/finance.rb', line 22 def use_ssl @use_ssl end |
Class Method Details
.defaults ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/hg/finance.rb', line 50 def self.defaults { key: self.api_key, locale: self.locale, format: :json, sdk_version: "ruby_f#{HG::Finance::VERSION}" } end |
.get(options = {}) ⇒ Object
40 41 42 |
# File 'lib/hg/finance.rb', line 40 def self.get( = {}) process({}) end |
.process(params) ⇒ Object
44 45 46 47 48 |
# File 'lib/hg/finance.rb', line 44 def self.process params params = defaults.merge(params).delete_if{|k,v| v.nil?} return HG::Finance::Data.new(params, HOST_NAME, self.use_ssl) end |
.setup {|_self| ... } ⇒ Object
36 37 38 |
# File 'lib/hg/finance.rb', line 36 def self.setup(&block) yield self end |