freebase-api 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b7e8a2c6fe8238795c80a201f277020c42ea8ea
4
+ data.tar.gz: e627b3686db5e0db9f374b9130f720e3ae5e2aed
5
+ SHA512:
6
+ metadata.gz: a8074d7dc7be46e31da0c6bff00e6f021dbf1fd477a2d2a00130277e30f96cec052b70aa07056a7625eb71f2817ce10f5bb5b1b703b4c24aa4f83f14de2f84dc
7
+ data.tar.gz: d989451faf085ac0cf720e1d5c666115b785912ab05641a6fb237d4337efabdc647b95f60dcf2a48db69c331ce1a236eeea9cec6dadd003fe45fbcb05c4eca5c
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  /.env
3
3
  /pkg/
4
4
  /doc/
5
+ /.bundle/
6
+ /Gemfile.lock
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --colour
2
2
  --format documentation
3
+ --tty
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - rbx-19mode
4
3
  - jruby-19mode
5
- - 1.9.2
6
4
  - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
7
  - ruby-head
8
8
  - jruby-head
data/Gemfile CHANGED
@@ -7,8 +7,7 @@ group :test do
7
7
  gem 'rspec', '~> 2.12'
8
8
  gem 'yard', '~> 0.8'
9
9
  gem 'simplecov', '~> 0.7', :require => false
10
- gem 'redcarpet', '~> 2.2'
11
10
  end
12
11
 
13
12
  # Specify your gem's dependencies in freebase-api.gemspec
14
- gemspec
13
+ gemspec
data/README.markdown CHANGED
@@ -30,13 +30,14 @@ If you have a [Google API key](https://code.google.com/apis/console), you can se
30
30
  You can override the default session by providing some options, like the language or the environment.
31
31
 
32
32
  ```ruby
33
- FreebaseAPI.session = FreebaseAPI::Session.new(key: 'GOOGLE_API_KEY', env: => :stable)
33
+ FreebaseAPI.session = FreebaseAPI::Session.new(key: 'GOOGLE_API_KEY', env: :stable)
34
34
  ```
35
35
 
36
36
  Options are :
37
37
 
38
38
  * `:key` : your Google API key
39
39
  * `:env` : the environment (sandbox or stable) (default is :stable)
40
+ * `:proxy` : an optional url for a proxy that requests will be sent through
40
41
  * `:query_options` : some options that will be used in each query
41
42
  * `:limit` : the number of items returned (default is 10)
42
43
  * `:lang` : the language you would like the content in (default is 'en')
@@ -21,7 +21,7 @@ module FreebaseAPI
21
21
  @env = options[:env]
22
22
  @key = options[:key] || ENV['GOOGLE_API_KEY']
23
23
  @query_options = options[:query_options]
24
- @proxy_options = get_proxy_options
24
+ @proxy_options = get_proxy_options(options[:proxy])
25
25
  end
26
26
 
27
27
  # Execute a MQL read query
@@ -117,9 +117,9 @@ module FreebaseAPI
117
117
  # Get the proxy options for HTTParty
118
118
  #
119
119
  # @return [Hash] the proxy options
120
- def get_proxy_options
120
+ def get_proxy_options(url=nil)
121
121
  options = {}
122
- if url = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
122
+ if url = url || ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
123
123
  proxy_uri = URI.parse(url)
124
124
  options[:http_proxyaddr] = proxy_uri.host
125
125
  options[:http_proxyport] = proxy_uri.port
@@ -1,3 +1,3 @@
1
1
  module FreebaseAPI
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/spec/image_spec.rb CHANGED
@@ -40,7 +40,7 @@ describe FreebaseAPI::Image do
40
40
  end
41
41
 
42
42
  describe "#size" do
43
- it "should return the topic related ID" do
43
+ it "should return the image size" do
44
44
  image.size.should == data.size
45
45
  end
46
46
  end
data/spec/session_spec.rb CHANGED
@@ -45,7 +45,7 @@ describe FreebaseAPI::Session do
45
45
  end
46
46
 
47
47
  context "in a stable environnment" do
48
- it "should return the sandbox service URL" do
48
+ it "should return the stable service URL" do
49
49
  session.send(:surl, 'service').should == 'https://www.googleapis.com/freebase/v1/service'
50
50
  end
51
51
  end
@@ -182,5 +182,23 @@ describe FreebaseAPI::Session do
182
182
  session.send(:get, 'URL')
183
183
  end
184
184
  end
185
+
186
+ context "with a proxy configuration" do
187
+ let(:session) { FreebaseAPI::Session.new(:proxy => 'http://user:pass@site.com:2020') }
188
+
189
+ before do
190
+ session.stub(:handle_response)
191
+ end
192
+
193
+ it "should use the proxy" do
194
+ session.class.should_receive(:get) do |url, params, options|
195
+ params[:http_proxyaddr].should eq "site.com"
196
+ params[:http_proxyport].should eq 2020
197
+ params[:http_proxyuser].should eq "user"
198
+ params[:http_proxypass].should eq "pass"
199
+ end
200
+ session.send(:get, 'URL')
201
+ end
202
+ end
185
203
  end
186
- end
204
+ end
@@ -6,7 +6,7 @@ module FreebaseAPI
6
6
  end
7
7
 
8
8
  def load_data(file)
9
- IO.read(File.join(File.dirname(__FILE__), "..", "fixtures", file))
9
+ IO.read(File.join(File.dirname(__FILE__), "..", "fixtures", file), encoding: 'BINARY')
10
10
  end
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freebase-api
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.3
4
+ version: 0.1.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Aymeric Brisse
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-05 00:00:00.000000000 Z
11
+ date: 2014-07-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- prerelease: false
16
14
  name: httparty
17
- type: :runtime
18
15
  requirement: !ruby/object:Gem::Requirement
19
16
  requirements:
20
- - - ~>
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '0.10'
23
- none: false
20
+ type: :runtime
21
+ prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
23
  requirements:
26
- - - ~>
24
+ - - "~>"
27
25
  - !ruby/object:Gem::Version
28
26
  version: '0.10'
29
- none: false
30
27
  description: A library to use the Freebase API
31
28
  email:
32
29
  - aymeric.brisse@mperfect-memory.com
@@ -34,10 +31,10 @@ executables: []
34
31
  extensions: []
35
32
  extra_rdoc_files: []
36
33
  files:
37
- - .gitignore
38
- - .rspec
34
+ - ".gitignore"
35
+ - ".rspec"
36
+ - ".travis.yml"
39
37
  - Gemfile
40
- - Gemfile.lock
41
38
  - LICENSE.txt
42
39
  - README.markdown
43
40
  - Rakefile
@@ -60,36 +57,28 @@ files:
60
57
  - spec/spec_helper.rb
61
58
  - spec/support/helpers.rb
62
59
  - spec/topic_spec.rb
63
- - travis.yml
64
60
  homepage: https://github.com/PerfectMemory/freebase-api
65
61
  licenses: []
62
+ metadata: {}
66
63
  post_install_message:
67
64
  rdoc_options: []
68
65
  require_paths:
69
66
  - lib
70
67
  required_ruby_version: !ruby/object:Gem::Requirement
71
68
  requirements:
72
- - - ! '>='
69
+ - - ">="
73
70
  - !ruby/object:Gem::Version
74
- segments:
75
- - 0
76
- hash: 2916215866854017455
77
71
  version: '0'
78
- none: false
79
72
  required_rubygems_version: !ruby/object:Gem::Requirement
80
73
  requirements:
81
- - - ! '>='
74
+ - - ">="
82
75
  - !ruby/object:Gem::Version
83
- segments:
84
- - 0
85
- hash: 2916215866854017455
86
76
  version: '0'
87
- none: false
88
77
  requirements: []
89
78
  rubyforge_project:
90
- rubygems_version: 1.8.25
79
+ rubygems_version: 2.2.1
91
80
  signing_key:
92
- specification_version: 3
81
+ specification_version: 4
93
82
  summary: Provides access to both a raw-access and an abstract-layer to the Freebase
94
83
  API
95
84
  test_files:
data/Gemfile.lock DELETED
@@ -1,54 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- freebase-api (0.1.3)
5
- httparty (~> 0.10)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- colorize (0.5.8)
11
- coveralls (0.6.7)
12
- colorize
13
- multi_json (~> 1.3)
14
- rest-client
15
- simplecov (>= 0.7)
16
- thor
17
- diff-lcs (1.2.4)
18
- httparty (0.12.0)
19
- json (~> 1.8)
20
- multi_xml (>= 0.5.2)
21
- json (1.8.1)
22
- mime-types (1.23)
23
- multi_json (1.7.2)
24
- multi_xml (0.5.5)
25
- rake (10.0.4)
26
- redcarpet (2.2.2)
27
- rest-client (1.6.7)
28
- mime-types (>= 1.16)
29
- rspec (2.13.0)
30
- rspec-core (~> 2.13.0)
31
- rspec-expectations (~> 2.13.0)
32
- rspec-mocks (~> 2.13.0)
33
- rspec-core (2.13.1)
34
- rspec-expectations (2.13.0)
35
- diff-lcs (>= 1.1.3, < 2.0)
36
- rspec-mocks (2.13.1)
37
- simplecov (0.7.1)
38
- multi_json (~> 1.0)
39
- simplecov-html (~> 0.7.1)
40
- simplecov-html (0.7.1)
41
- thor (0.18.1)
42
- yard (0.8.6.1)
43
-
44
- PLATFORMS
45
- ruby
46
-
47
- DEPENDENCIES
48
- coveralls
49
- freebase-api!
50
- rake (~> 10.0)
51
- redcarpet (~> 2.2)
52
- rspec (~> 2.12)
53
- simplecov (~> 0.7)
54
- yard (~> 0.8)