here_places 0.0.2 → 0.1.0
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.
- checksums.yaml +7 -0
- data/README.md +25 -27
- data/here_places.gemspec +6 -5
- data/lib/here_places.rb +19 -2
- data/lib/here_places/base.rb +24 -23
- data/lib/here_places/category.rb +8 -5
- data/lib/here_places/discover.rb +9 -5
- data/lib/here_places/error.rb +2 -2
- data/lib/here_places/suggest.rb +8 -5
- data/lib/here_places/version.rb +1 -1
- data/spec/category_spec.rb +9 -13
- data/spec/discover_spec.rb +21 -13
- data/spec/error_spec.rb +14 -0
- data/spec/fixtures/vcr_cassettes/categories.yml +99 -0
- data/spec/fixtures/vcr_cassettes/explore.yml +460 -0
- data/spec/fixtures/vcr_cassettes/here.yml +141 -0
- data/spec/fixtures/vcr_cassettes/places.yml +101 -0
- data/spec/fixtures/vcr_cassettes/search.yml +445 -0
- data/spec/fixtures/vcr_cassettes/suggest-bad.yml +51 -0
- data/spec/fixtures/vcr_cassettes/suggest.yml +67 -0
- data/spec/spec_helper.rb +16 -3
- data/spec/suggest_spec.rb +8 -13
- data/wercker.yml +27 -0
- metadata +54 -37
- data/lib/here_places/place.rb +0 -10
- data/spec/base_spec.rb +0 -49
- data/spec/place_spec.rb +0 -18
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: http://places.nlp.nokia.com/places/v1/suggest?app_code=<APP_CODE>&app_id=<APP_ID>&q=berl
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
User-Agent:
|
|
11
|
+
- Faraday v0.9.1
|
|
12
|
+
Accept-Encoding:
|
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
14
|
+
Accept:
|
|
15
|
+
- "*/*"
|
|
16
|
+
response:
|
|
17
|
+
status:
|
|
18
|
+
code: 400
|
|
19
|
+
message: Bad Request
|
|
20
|
+
headers:
|
|
21
|
+
Cache-Control:
|
|
22
|
+
- no-store, must-revalidate
|
|
23
|
+
Content-Language:
|
|
24
|
+
- en
|
|
25
|
+
Content-Type:
|
|
26
|
+
- application/json; charset=UTF-8
|
|
27
|
+
Date:
|
|
28
|
+
- Sat, 25 Apr 2015 13:25:39 GMT
|
|
29
|
+
Expires:
|
|
30
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
|
31
|
+
- Thu, 26 Apr 1970 20:00:00 GMT
|
|
32
|
+
Pragma:
|
|
33
|
+
- no-cache
|
|
34
|
+
Set-Cookie:
|
|
35
|
+
- NLP.PP=dad5f0b4-00e3-472e-95f0-b400e3272e27;Path=/;Domain=.nlp.nokia.com;Expires=Thu,
|
|
36
|
+
22-Oct-2015 13:25:39 GMT
|
|
37
|
+
- NLP.PS=a4e236ba-bed6-41dc-a236-babed6e1dcad;Path=/;Domain=.nlp.nokia.com
|
|
38
|
+
Vary:
|
|
39
|
+
- Accept, Accept-Encoding, Accept-Language, X-Map-Viewport, Geolocation, X-Mobility-Mode
|
|
40
|
+
X-Nlp-Tid:
|
|
41
|
+
- faa8d50f-5ff1-43cc-a8d5-0f5ff183cc68
|
|
42
|
+
Content-Length:
|
|
43
|
+
- '83'
|
|
44
|
+
Connection:
|
|
45
|
+
- keep-alive
|
|
46
|
+
body:
|
|
47
|
+
encoding: UTF-8
|
|
48
|
+
string: '{"status":400,"message":"No position or bounding box information."}'
|
|
49
|
+
http_version:
|
|
50
|
+
recorded_at: Sat, 25 Apr 2015 13:25:39 GMT
|
|
51
|
+
recorded_with: VCR 2.9.3
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: http://places.nlp.nokia.com/places/v1/suggest?app_code=<APP_CODE>&app_id=<APP_ID>&at=52.5159,13.3777&q=berl
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
User-Agent:
|
|
11
|
+
- Faraday v0.9.1
|
|
12
|
+
Accept-Encoding:
|
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
14
|
+
Accept:
|
|
15
|
+
- "*/*"
|
|
16
|
+
response:
|
|
17
|
+
status:
|
|
18
|
+
code: 200
|
|
19
|
+
message: OK
|
|
20
|
+
headers:
|
|
21
|
+
Cache-Control:
|
|
22
|
+
- no-store, must-revalidate
|
|
23
|
+
Content-Language:
|
|
24
|
+
- en
|
|
25
|
+
Content-Type:
|
|
26
|
+
- application/json; charset=UTF-8
|
|
27
|
+
Date:
|
|
28
|
+
- Sat, 25 Apr 2015 13:07:38 GMT
|
|
29
|
+
Expires:
|
|
30
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
|
31
|
+
- Thu, 26 Apr 1970 20:00:00 GMT
|
|
32
|
+
Pragma:
|
|
33
|
+
- no-cache
|
|
34
|
+
Set-Cookie:
|
|
35
|
+
- NLP.PP=4ed71ec3-ba9e-4f3b-971e-c3ba9e5f3bd4;Path=/;Domain=.nlp.nokia.com;Expires=Thu,
|
|
36
|
+
22-Oct-2015 13:07:38 GMT
|
|
37
|
+
- NLP.PS=bea27caf-a77b-43c7-a27c-afa77bb3c785;Path=/;Domain=.nlp.nokia.com
|
|
38
|
+
Vary:
|
|
39
|
+
- Accept, Accept-Encoding, Accept-Language, X-Map-Viewport, Geolocation, X-Mobility-Mode
|
|
40
|
+
X-Nlp-Tid:
|
|
41
|
+
- 1206ebbb-56ed-476f-86eb-bb56ed976f26
|
|
42
|
+
Content-Length:
|
|
43
|
+
- '328'
|
|
44
|
+
Connection:
|
|
45
|
+
- keep-alive
|
|
46
|
+
body:
|
|
47
|
+
encoding: ASCII-8BIT
|
|
48
|
+
string: !binary |-
|
|
49
|
+
eyJzdWdnZXN0aW9ucyI6WyJCZXJsaW4sIEdlcm1hbnkiLCJDb3JhLUJlcmxp
|
|
50
|
+
bmVyLVN0cmHDn2UsIDEwMTE3IEJlcmxpbiwgR2VybWFueSIsIkJlcmxpbiBU
|
|
51
|
+
b3VyaXNtdXMgTWFya2V0aW5nIiwiQmVybGluZXIgU3Bhcmthc3NlIiwiQmVy
|
|
52
|
+
bGluZXIgRnJlaWhlaXQsIDEwNzg1IEJlcmxpbiwgR2VybWFueSIsIkVtYmFz
|
|
53
|
+
c3kgb2YgdGhlIFVuaXRlZCBTdGF0ZXMgQmVybGluIiwiTmV1ZW5oYWdlbiBi
|
|
54
|
+
ZWkgQmVybGluLCBHZXJtYW55IiwiQmVybGluZXIgVm9sa3NiYW5rIiwiQmVy
|
|
55
|
+
bGluZXIgTWF1ZXJ3ZWcsIDEwMTE3IEJlcmxpbiwgR2VybWFueSIsIkJlcmxp
|
|
56
|
+
biBUb3VyaXN0IEluZm8iLCJTY2jDtm5laWNoZSBiZWkgQmVybGluLCBHZXJt
|
|
57
|
+
YW55IiwiQW0gQmVybGluLU11c2V1bSwgMTA5NjkgQmVybGluLCBHZXJtYW55
|
|
58
|
+
IiwiRsO2cmRlcmtyZWlzIFJhdW0gZGVyIFN0aWxsZSBpbiBCZXJsaW4gZS5W
|
|
59
|
+
LiIsIkJlcm5hdSBiZWkgQmVybGluLCBHZXJtYW55IiwiQmVybGluIGluZm9z
|
|
60
|
+
dG9yZSIsIkJlcmxpbmVyIFZvcnN0YWR0LCBQb3RzZGFtLCBHZXJtYW55Iiwi
|
|
61
|
+
QmVybGljaGluZ2Vuc3RyYcOfZSwgMTA1NTMgQmVybGluLCBHZXJtYW55Iiwi
|
|
62
|
+
RXZlcnl0aGluZyBBYm91dCBCZXJsaW4iLCJSw7xkZXJzZG9yZiBiZWkgQmVy
|
|
63
|
+
bGluLCBHZXJtYW55IiwiQmVybGluZXIgU3RyYcOfZSwgMTA3MTUgQmVybGlu
|
|
64
|
+
LCBHZXJtYW55Il19
|
|
65
|
+
http_version:
|
|
66
|
+
recorded_at: Sat, 25 Apr 2015 13:06:09 GMT
|
|
67
|
+
recorded_with: VCR 2.9.3
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'bundler'
|
|
3
3
|
require 'rspec'
|
|
4
|
-
require 'fakeweb'
|
|
5
4
|
require 'here_places'
|
|
5
|
+
require 'vcr'
|
|
6
|
+
require 'faraday'
|
|
7
|
+
require 'webmock'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
RSpec.configure do |config|
|
|
10
|
+
|
|
11
|
+
VCR.configure do |c|
|
|
12
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
|
13
|
+
c.hook_into :webmock
|
|
14
|
+
c.filter_sensitive_data('<APP_ID>') { 'APP_ID' }
|
|
15
|
+
c.filter_sensitive_data('<APP_CODE>') { 'APP_CODE' }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
config.before(:all) do
|
|
19
|
+
HerePlaces.set_keys('APP_ID', 'APP_CODE')
|
|
20
|
+
end
|
|
21
|
+
end
|
data/spec/suggest_spec.rb
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe HerePlaces::Suggest do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
app_code = 'APP_CODE'
|
|
7
|
-
@data = {test: 'stuff'}
|
|
8
|
-
@h = HerePlaces::Suggest.new(app_id, app_code)
|
|
9
|
-
@h.stub!(:api)
|
|
10
|
-
end
|
|
4
|
+
let(:api) { described_class.new }
|
|
5
|
+
let(:payload) { { at: '52.5159,13.3777', q: 'berl' } }
|
|
11
6
|
|
|
12
|
-
it
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
it "calls the api and returns results correctly" do
|
|
8
|
+
VCR.use_cassette("suggest", record: :once) do
|
|
9
|
+
results = api.suggest(payload)
|
|
10
|
+
expect(results["suggestions"][0]).to eq "Berlin, Germany"
|
|
11
|
+
end
|
|
17
12
|
end
|
|
18
|
-
end
|
|
13
|
+
end
|
data/wercker.yml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
box: wercker/rvm
|
|
2
|
+
# Build definition
|
|
3
|
+
build:
|
|
4
|
+
# The steps that will be executed on build
|
|
5
|
+
# See the Ruby section on the wercker devcenter:
|
|
6
|
+
# http://devcenter.wercker.com/articles/languages/ruby.html
|
|
7
|
+
steps:
|
|
8
|
+
# Uncomment this to force RVM to use a specific Ruby version
|
|
9
|
+
# - rvm-use:
|
|
10
|
+
# version: 2.2.2
|
|
11
|
+
|
|
12
|
+
# A step that executes `bundle install` command
|
|
13
|
+
- bundle-install
|
|
14
|
+
|
|
15
|
+
# A custom script step, name value is used in the UI
|
|
16
|
+
# and the code value contains the command that get executed
|
|
17
|
+
- script:
|
|
18
|
+
name: echo ruby information
|
|
19
|
+
code: |
|
|
20
|
+
echo "ruby version $(ruby --version) running"
|
|
21
|
+
echo "from location $(which ruby)"
|
|
22
|
+
echo -p "gem list: $(gem list)"
|
|
23
|
+
|
|
24
|
+
# Add more steps here:
|
|
25
|
+
- script:
|
|
26
|
+
name: rspec
|
|
27
|
+
code: bundle exec rspec
|
metadata
CHANGED
|
@@ -1,64 +1,71 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: here_places
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.1.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Prem Pillai
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2015-04-25 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: faraday
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.9.1
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.9.1
|
|
14
27
|
- !ruby/object:Gem::Dependency
|
|
15
28
|
name: rspec
|
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
30
|
requirements:
|
|
19
|
-
- - ~>
|
|
31
|
+
- - "~>"
|
|
20
32
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
33
|
+
version: '3.1'
|
|
22
34
|
type: :development
|
|
23
35
|
prerelease: false
|
|
24
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
37
|
requirements:
|
|
27
|
-
- - ~>
|
|
38
|
+
- - "~>"
|
|
28
39
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
40
|
+
version: '3.1'
|
|
30
41
|
- !ruby/object:Gem::Dependency
|
|
31
|
-
name:
|
|
42
|
+
name: vcr
|
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
44
|
requirements:
|
|
35
|
-
- - ~>
|
|
45
|
+
- - "~>"
|
|
36
46
|
- !ruby/object:Gem::Version
|
|
37
|
-
version: '
|
|
47
|
+
version: '2.9'
|
|
38
48
|
type: :development
|
|
39
49
|
prerelease: false
|
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
51
|
requirements:
|
|
43
|
-
- - ~>
|
|
52
|
+
- - "~>"
|
|
44
53
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
54
|
+
version: '2.9'
|
|
46
55
|
- !ruby/object:Gem::Dependency
|
|
47
|
-
name:
|
|
56
|
+
name: webmock
|
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
58
|
requirements:
|
|
51
|
-
- - ~>
|
|
59
|
+
- - "~>"
|
|
52
60
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
54
|
-
type: :
|
|
61
|
+
version: '1.21'
|
|
62
|
+
type: :development
|
|
55
63
|
prerelease: false
|
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
65
|
requirements:
|
|
59
|
-
- - ~>
|
|
66
|
+
- - "~>"
|
|
60
67
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
68
|
+
version: '1.21'
|
|
62
69
|
description: A wafer-thin Ruby Wrapper for Nokia's Here Places API
|
|
63
70
|
email:
|
|
64
71
|
- prem.pillai@gmail.com
|
|
@@ -66,7 +73,7 @@ executables: []
|
|
|
66
73
|
extensions: []
|
|
67
74
|
extra_rdoc_files: []
|
|
68
75
|
files:
|
|
69
|
-
- .gitignore
|
|
76
|
+
- ".gitignore"
|
|
70
77
|
- Gemfile
|
|
71
78
|
- LICENSE.txt
|
|
72
79
|
- README.md
|
|
@@ -77,45 +84,55 @@ files:
|
|
|
77
84
|
- lib/here_places/category.rb
|
|
78
85
|
- lib/here_places/discover.rb
|
|
79
86
|
- lib/here_places/error.rb
|
|
80
|
-
- lib/here_places/place.rb
|
|
81
87
|
- lib/here_places/suggest.rb
|
|
82
88
|
- lib/here_places/version.rb
|
|
83
|
-
- spec/base_spec.rb
|
|
84
89
|
- spec/category_spec.rb
|
|
85
90
|
- spec/discover_spec.rb
|
|
86
|
-
- spec/
|
|
91
|
+
- spec/error_spec.rb
|
|
92
|
+
- spec/fixtures/vcr_cassettes/categories.yml
|
|
93
|
+
- spec/fixtures/vcr_cassettes/explore.yml
|
|
94
|
+
- spec/fixtures/vcr_cassettes/here.yml
|
|
95
|
+
- spec/fixtures/vcr_cassettes/places.yml
|
|
96
|
+
- spec/fixtures/vcr_cassettes/search.yml
|
|
97
|
+
- spec/fixtures/vcr_cassettes/suggest-bad.yml
|
|
98
|
+
- spec/fixtures/vcr_cassettes/suggest.yml
|
|
87
99
|
- spec/spec_helper.rb
|
|
88
100
|
- spec/suggest_spec.rb
|
|
101
|
+
- wercker.yml
|
|
89
102
|
homepage: https://github.com/premjg/here_places
|
|
90
103
|
licenses:
|
|
91
104
|
- MIT
|
|
105
|
+
metadata: {}
|
|
92
106
|
post_install_message:
|
|
93
107
|
rdoc_options: []
|
|
94
108
|
require_paths:
|
|
95
109
|
- lib
|
|
96
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
111
|
requirements:
|
|
99
|
-
- -
|
|
112
|
+
- - ">="
|
|
100
113
|
- !ruby/object:Gem::Version
|
|
101
114
|
version: '0'
|
|
102
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
|
-
none: false
|
|
104
116
|
requirements:
|
|
105
|
-
- -
|
|
117
|
+
- - ">="
|
|
106
118
|
- !ruby/object:Gem::Version
|
|
107
119
|
version: '0'
|
|
108
120
|
requirements: []
|
|
109
121
|
rubyforge_project:
|
|
110
|
-
rubygems_version:
|
|
122
|
+
rubygems_version: 2.2.2
|
|
111
123
|
signing_key:
|
|
112
|
-
specification_version:
|
|
124
|
+
specification_version: 4
|
|
113
125
|
summary: A wafer-thin Ruby Wrapper for Nokia's Here Places API
|
|
114
126
|
test_files:
|
|
115
|
-
- spec/base_spec.rb
|
|
116
127
|
- spec/category_spec.rb
|
|
117
128
|
- spec/discover_spec.rb
|
|
118
|
-
- spec/
|
|
129
|
+
- spec/error_spec.rb
|
|
130
|
+
- spec/fixtures/vcr_cassettes/categories.yml
|
|
131
|
+
- spec/fixtures/vcr_cassettes/explore.yml
|
|
132
|
+
- spec/fixtures/vcr_cassettes/here.yml
|
|
133
|
+
- spec/fixtures/vcr_cassettes/places.yml
|
|
134
|
+
- spec/fixtures/vcr_cassettes/search.yml
|
|
135
|
+
- spec/fixtures/vcr_cassettes/suggest-bad.yml
|
|
136
|
+
- spec/fixtures/vcr_cassettes/suggest.yml
|
|
119
137
|
- spec/spec_helper.rb
|
|
120
138
|
- spec/suggest_spec.rb
|
|
121
|
-
has_rdoc:
|
data/lib/here_places/place.rb
DELETED
data/spec/base_spec.rb
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe HerePlaces::Base do
|
|
4
|
-
before(:each) do
|
|
5
|
-
@app_id = 'APP_ID'
|
|
6
|
-
@app_code = 'APP_CODE'
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
context "after initialize" do
|
|
10
|
-
it 'calls the setup method' do
|
|
11
|
-
HerePlaces::Base.any_instance.stub(:setup)
|
|
12
|
-
HerePlaces::Base.any_instance.should_receive(:setup)
|
|
13
|
-
@h = HerePlaces::Base.new(@app_id, @app_code)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
context "the setup method" do
|
|
18
|
-
it "correctly sets up the Faraday connection object" do
|
|
19
|
-
@h = HerePlaces::Base.new(@app_id, @app_code)
|
|
20
|
-
@h.conn.should be_an_instance_of(Faraday::Connection)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "api method" do
|
|
25
|
-
before(:each) do
|
|
26
|
-
@url_fragment = 'some/url/fragment'
|
|
27
|
-
@data = {test: 'stuff'}
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
after(:each) do
|
|
31
|
-
FakeWeb.clean_registry
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "correctly constructs the API URL and makes calls" do
|
|
35
|
-
@h = HerePlaces::Base.new(@app_id, @app_code)
|
|
36
|
-
FakeWeb.register_uri(:get, %r|^http:\/\/places\.nlp\.nokia\.com\/.*|, :body => {stuff: 'test'}.to_json)
|
|
37
|
-
@h.api(@url_fragment, @data)
|
|
38
|
-
@parametrized_data = URI.encode_www_form(@data)
|
|
39
|
-
FakeWeb.last_request.path.should eq("/#{@url_fragment}?app_id=#{@app_id}&app_code=#{@app_code}&#{@parametrized_data}")
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "flips out and raises error when it receives an API error" do
|
|
43
|
-
@h = HerePlaces::Base.new(@app_id, @app_code)
|
|
44
|
-
FakeWeb.register_uri(:get, %r|^http:\/\/places\.nlp\.nokia\.com\/.*|, :body => {status: 400, stuff: 'test'}.to_json)
|
|
45
|
-
expect {@h.api(@url_fragment, @data)}.to raise_error(HerePlaces::APIError)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
end
|
data/spec/place_spec.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe HerePlaces::Place do
|
|
4
|
-
before(:each) do
|
|
5
|
-
app_id = 'APP_ID'
|
|
6
|
-
app_code = 'APP_CODE'
|
|
7
|
-
@id = '123asdfa'
|
|
8
|
-
@h = HerePlaces::Place.new(app_id, app_code)
|
|
9
|
-
@h.stub!(:api)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it 'responds correctly to places method and delegates to the api call' do
|
|
13
|
-
resource_url = "#{API_PREFIX}/places/#{@id}"
|
|
14
|
-
@h.should respond_to(:places)
|
|
15
|
-
@h.should_receive(:api).with(resource_url)
|
|
16
|
-
@h.places(@id)
|
|
17
|
-
end
|
|
18
|
-
end
|