factual-api 1.3.4 → 1.3.5
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 +4 -0
- data/README.md +4 -4
- data/lib/factual/api.rb +11 -3
- data/lib/factual/query/base.rb +5 -1
- data/lib/factual/query/table.rb +6 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# About
|
2
2
|
|
3
|
-
This is the Factual supported Ruby driver for [Factual's public API](http://developer.factual.com
|
3
|
+
This is the Factual supported Ruby driver for [Factual's public API](http://developer.factual.com).
|
4
4
|
|
5
5
|
|
6
6
|
# Overview
|
@@ -53,7 +53,7 @@ factual.table("places").filters("name" => {"$bw" => "starbucks"}).rows
|
|
53
53
|
|
54
54
|
`````ruby
|
55
55
|
# Return entity names and non-blank websites from the Global dataset, for entities located in Thailand
|
56
|
-
factual.table("
|
56
|
+
factual.table("places").select(:name, :website)
|
57
57
|
.filters({"country" => "TH", "website" => {"$blank" => false}})
|
58
58
|
````
|
59
59
|
|
@@ -91,8 +91,8 @@ query.first["income"]
|
|
91
91
|
## More Read Examples
|
92
92
|
|
93
93
|
````ruby
|
94
|
-
# 1. Specify the table Global
|
95
|
-
query = factual.table("
|
94
|
+
# 1. Specify the table Global Places
|
95
|
+
query = factual.table("places")
|
96
96
|
````
|
97
97
|
|
98
98
|
````ruby
|
data/lib/factual/api.rb
CHANGED
@@ -4,7 +4,7 @@ require 'timeout'
|
|
4
4
|
|
5
5
|
class Factual
|
6
6
|
class API
|
7
|
-
VERSION = "1.3.
|
7
|
+
VERSION = "1.3.5"
|
8
8
|
API_V3_HOST = "api.v3.factual.com"
|
9
9
|
DRIVER_VERSION_TAG = "factual-ruby-driver-v" + VERSION
|
10
10
|
PARAM_ALIASES = { :search => :q, :sort_asc => :sort }
|
@@ -31,7 +31,11 @@ class Factual
|
|
31
31
|
|
32
32
|
def raw_get(path, query)
|
33
33
|
path = '/' + path unless path =~ /^\//
|
34
|
-
url = "http://#{@host}#{path}
|
34
|
+
url = "http://#{@host}#{path}"
|
35
|
+
|
36
|
+
qs = query_string(query)
|
37
|
+
url += "?#{qs}" unless qs.empty?
|
38
|
+
|
35
39
|
resp = make_request(url)
|
36
40
|
payload = JSON.parse(resp.body)
|
37
41
|
handle_payload(payload)
|
@@ -61,7 +65,11 @@ class Factual
|
|
61
65
|
def full_path(action, path, params)
|
62
66
|
fp = "/#{path}"
|
63
67
|
fp += "/#{action}" unless action == :read
|
64
|
-
|
68
|
+
|
69
|
+
qs = query_string(params)
|
70
|
+
fp += "?#{qs}" unless qs.empty?
|
71
|
+
|
72
|
+
fp
|
65
73
|
end
|
66
74
|
|
67
75
|
private
|
data/lib/factual/query/base.rb
CHANGED
data/lib/factual/query/table.rb
CHANGED
@@ -43,6 +43,12 @@ class Factual
|
|
43
43
|
offset = (page_number - 1) * limit
|
44
44
|
Table.new(@api, @path, @params.merge(:limit => limit, :offset => offset))
|
45
45
|
end
|
46
|
+
|
47
|
+
def row(factual_id)
|
48
|
+
@path += "/#{factual_id}"
|
49
|
+
@params = {}
|
50
|
+
return self.first
|
51
|
+
end
|
46
52
|
end
|
47
53
|
end
|
48
54
|
end
|
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.5
|
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-04-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: oauth
|