factual-api 1.3 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/README.md +1 -12
- data/lib/factual.rb +0 -10
- data/lib/factual/api.rb +1 -1
- metadata +47 -55
- data/lib/factual/query/crosswalk.rb +0 -31
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -42,6 +42,7 @@ Once the gem is installed, you can use it in your Ruby project like:
|
|
42
42
|
require 'factual'
|
43
43
|
factual = Factual.new("YOUR_KEY", "YOUR_SECRET")
|
44
44
|
````
|
45
|
+
If you don't have a Factual API account yet, [it's free and easy to get one](https://www.factual.com/api-keys/request).
|
45
46
|
|
46
47
|
## Simple Read Examples
|
47
48
|
|
@@ -64,18 +65,6 @@ factual.table("restaurants-us")
|
|
64
65
|
|
65
66
|
## Simple Places Example
|
66
67
|
|
67
|
-
````ruby
|
68
|
-
# Concordance information of a place
|
69
|
-
FACTUAL_ID = "110ace9f-80a7-47d3-9170-e9317624ebd9"
|
70
|
-
query = factual.crosswalk(FACTUAL_ID)
|
71
|
-
query.rows
|
72
|
-
|
73
|
-
# Or specify a place with its namespace_id and namespace
|
74
|
-
SIMPLEGEO_ID = "SG_6XIEi3qehN44LH8m8i86v0"
|
75
|
-
query = factual.crosswalk(SIMPLEGEO_ID, :simplegeo)
|
76
|
-
query.rows
|
77
|
-
````
|
78
|
-
|
79
68
|
````ruby
|
80
69
|
# Returns resolved entities as an array of hashes
|
81
70
|
query = factual.resolve("name" => "McDonalds",
|
data/lib/factual.rb
CHANGED
@@ -4,7 +4,6 @@ require 'factual/query/table'
|
|
4
4
|
require 'factual/query/facets'
|
5
5
|
require 'factual/query/match'
|
6
6
|
require 'factual/query/resolve'
|
7
|
-
require 'factual/query/crosswalk'
|
8
7
|
require 'factual/query/monetize'
|
9
8
|
require 'factual/query/geocode'
|
10
9
|
require 'factual/query/geopulse'
|
@@ -27,15 +26,6 @@ class Factual
|
|
27
26
|
Query::Facets.new(@api, "t/#{table_id_or_alias}")
|
28
27
|
end
|
29
28
|
|
30
|
-
def crosswalk(namespace_id, namespace = nil)
|
31
|
-
if namespace
|
32
|
-
raise "DEPRECATED. For more information, please visit http://developer.factual.com/display/docs/Places+API+-+Crosswalk"
|
33
|
-
Query::Crosswalk.new(@api, :filters => {:namespace_id => namespace_id, :namespace => namespace})
|
34
|
-
else
|
35
|
-
Query::Crosswalk.new(@api, :filters => {:factual_id => namespace_id})
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
29
|
def monetize
|
40
30
|
Query::Monetize.new(@api)
|
41
31
|
end
|
data/lib/factual/api.rb
CHANGED
metadata
CHANGED
@@ -1,77 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: factual-api
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.3'
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 1.3.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Rudiger Lippert
|
9
9
|
- Forrest Cao
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
date: 2012-08-20 00:00:00 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
16
17
|
name: oauth
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ! '>='
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.4.4
|
23
|
-
type: :runtime
|
24
18
|
prerelease: false
|
25
|
-
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
20
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
30
24
|
version: 0.4.4
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: json
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
|
-
requirements:
|
36
|
-
- - ! '>='
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 1.2.0
|
39
25
|
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
40
29
|
prerelease: false
|
41
|
-
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
31
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
46
35
|
version: 1.2.0
|
47
|
-
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
48
39
|
name: rspec
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :development
|
56
40
|
prerelease: false
|
57
|
-
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
42
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version:
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
63
49
|
description: Factual's official Ruby driver for the Factual public API.
|
64
|
-
email:
|
50
|
+
email:
|
65
51
|
- rudy@factual.com
|
66
52
|
- forrest@factual.com
|
67
53
|
executables: []
|
54
|
+
|
68
55
|
extensions: []
|
56
|
+
|
69
57
|
extra_rdoc_files: []
|
70
|
-
|
58
|
+
|
59
|
+
files:
|
71
60
|
- lib/factual/api.rb
|
72
61
|
- lib/factual/multi.rb
|
73
62
|
- lib/factual/query/base.rb
|
74
|
-
- lib/factual/query/crosswalk.rb
|
75
63
|
- lib/factual/query/facets.rb
|
76
64
|
- lib/factual/query/geocode.rb
|
77
65
|
- lib/factual/query/geopulse.rb
|
@@ -87,26 +75,30 @@ files:
|
|
87
75
|
- CHANGELOG.md
|
88
76
|
homepage: http://github.com/Factual/factual-ruby-driver
|
89
77
|
licenses: []
|
78
|
+
|
90
79
|
post_install_message:
|
91
80
|
rdoc_options: []
|
92
|
-
|
81
|
+
|
82
|
+
require_paths:
|
93
83
|
- lib
|
94
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
85
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
99
89
|
version: 1.8.6
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
91
|
none: false
|
102
|
-
requirements:
|
103
|
-
- -
|
104
|
-
- !ruby/object:Gem::Version
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
105
95
|
version: 1.3.6
|
106
96
|
requirements: []
|
97
|
+
|
107
98
|
rubyforge_project:
|
108
99
|
rubygems_version: 1.8.24
|
109
100
|
signing_key:
|
110
101
|
specification_version: 3
|
111
102
|
summary: Ruby driver for Factual
|
112
103
|
test_files: []
|
104
|
+
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'factual/query/base'
|
2
|
-
|
3
|
-
class Factual
|
4
|
-
module Query
|
5
|
-
class Crosswalk < Base
|
6
|
-
def initialize(api, params = {})
|
7
|
-
@path = "t/crosswalk"
|
8
|
-
@action = :read
|
9
|
-
super(api, params)
|
10
|
-
end
|
11
|
-
|
12
|
-
def only(*namespaces)
|
13
|
-
filters = @params[:filters] ? @params[:filters].dup : {}
|
14
|
-
|
15
|
-
if (namespaces.length == 1)
|
16
|
-
filters.merge!(:namespace => namespaces.first)
|
17
|
-
else
|
18
|
-
filters.merge!(:namespace => {"$in" => namespaces})
|
19
|
-
end
|
20
|
-
|
21
|
-
self.class.new(@api, @params.merge(:filters => filters))
|
22
|
-
end
|
23
|
-
|
24
|
-
[:limit, :include_count].each do |param|
|
25
|
-
define_method(param) do |*args|
|
26
|
-
self.class.new(@api, @params.merge(param => form_value(args)))
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|