Class: Intrinio::API

Inherits:
APICake::Base
  • Object
show all
Defined in:
lib/intrinio/api.rb

Overview

Provides access to all the Intrinio API endpoints with dynamic methods anc caching.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ API

Returns a new instance of API.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/intrinio/api.rb', line 11

def initialize(opts={})
  if opts[:auth] 
    opts[:username], opts[:password] = opts[:auth].split ':'
    opts.delete :auth
  end

  @username, @password = opts[:username], opts[:password]

  cache.disable unless opts[:use_cache]
  cache.dir = opts[:cache_dir] if opts[:cache_dir]
  cache.life = opts[:cache_life] if opts[:cache_life]
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



9
10
11
# File 'lib/intrinio/api.rb', line 9

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



9
10
11
# File 'lib/intrinio/api.rb', line 9

def username
  @username
end

Instance Method Details

#default_paramsObject



24
25
26
# File 'lib/intrinio/api.rb', line 24

def default_params
  { basic_auth: { username: username, password: password } }
end