factual-api 1.3.10 → 1.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +3 -0
- data/lib/factual.rb +4 -0
- data/lib/factual/api.rb +7 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/lib/factual.rb
CHANGED
@@ -31,6 +31,10 @@ class Factual
|
|
31
31
|
@api = API.new(generate_token(key, secret), debug_mode, host, timeout)
|
32
32
|
end
|
33
33
|
|
34
|
+
def apply_header(key, value)
|
35
|
+
@api.apply_header(key, value)
|
36
|
+
end
|
37
|
+
|
34
38
|
def table(table_id_or_alias)
|
35
39
|
Query::Table.new(@api, "t/#{table_id_or_alias}")
|
36
40
|
end
|
data/lib/factual/api.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Factual
|
2
2
|
class API
|
3
|
-
VERSION = "1.3.
|
3
|
+
VERSION = "1.3.11"
|
4
4
|
API_V3_HOST = "api.v3.factual.com"
|
5
5
|
DRIVER_VERSION_TAG = "factual-ruby-driver-v" + VERSION
|
6
6
|
PARAM_ALIASES = { :search => :q, :sort_asc => :sort }
|
@@ -10,6 +10,11 @@ class Factual
|
|
10
10
|
@debug_mode = debug_mode
|
11
11
|
@timeout = timeout
|
12
12
|
@host = host || API_V3_HOST
|
13
|
+
@headers = {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def apply_header(key, value)
|
17
|
+
@headers[key] = value if value
|
13
18
|
end
|
14
19
|
|
15
20
|
def get(query, other_params = {})
|
@@ -100,6 +105,7 @@ class Factual
|
|
100
105
|
start_time = Time.now
|
101
106
|
|
102
107
|
headers = { "X-Factual-Lib" => DRIVER_VERSION_TAG }
|
108
|
+
headers.merge!(@headers)
|
103
109
|
|
104
110
|
res = if (method == :get)
|
105
111
|
Timeout::timeout(@timeout){ @access_token.get(url, headers) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factual-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: oauth
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: 1.3.6
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.8.
|
109
|
+
rubygems_version: 1.8.23
|
110
110
|
signing_key:
|
111
111
|
specification_version: 3
|
112
112
|
summary: Ruby driver for Factual
|