Module: Quandl::Client

Defined in:
lib/quandl/client.rb,
lib/quandl/client/her.rb,
lib/quandl/client/models.rb,
lib/quandl/client/version.rb,
lib/quandl/client/models/sheet.rb,
lib/quandl/client/models/source.rb,
lib/quandl/client/models/dataset.rb,
lib/quandl/client/models/dataset/properties.rb,
lib/quandl/client/models/dataset/searchable.rb

Defined Under Namespace

Modules: Models Classes: Dataset, Parser, Sheet, Source, TokenAuthentication

Constant Summary collapse

VERSION =
'0.0.3'
API_VERSION =
'v1'

Class Method Summary collapse

Class Method Details

.api_versionObject



8
9
10
# File 'lib/quandl/client/version.rb', line 8

def api_version
  API_VERSION
end

.her_apiObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/quandl/client/her.rb', line 17

def her_api
  # setup api
  api = Her::API.new
  api.setup url: rest_url do |c|
    c.use TokenAuthentication
    c.use Faraday::Request::UrlEncoded
    c.use Parser
    c.use Faraday::Adapter::NetHttp
  end
end

.reload_modelsObject



40
41
42
# File 'lib/quandl/client/her.rb', line 40

def reload_models
  Models.use_api( her_api )
end

.rest_urlObject



28
29
30
# File 'lib/quandl/client/her.rb', line 28

def rest_url
  @rest_url ||= 'http://www.quandl.com/api/'
end

.rest_url=(url) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/quandl/client/her.rb', line 32

def rest_url=(url)
  url = "http://#{url}" if ( url =~ /^http:\/\// ) == nil
  url = File.join(url, "#{API_VERSION}/")
  @rest_url = url
  reload_models
  @rest_url
end

.tokenObject



9
10
11
# File 'lib/quandl/client/her.rb', line 9

def token
  @token
end

.token=(token) ⇒ Object



12
13
14
15
# File 'lib/quandl/client/her.rb', line 12

def token=(token)
  @token = token
  reload_models
end

.use(url) ⇒ Object



5
6
7
# File 'lib/quandl/client/her.rb', line 5

def use(url)
  self.rest_url = url
end