thinknear 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/think_near/client.rb +4 -0
- data/lib/think_near/connection.rb +9 -5
- data/lib/think_near/endpoint.rb +5 -1
- data/thinknear.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
data/lib/think_near/client.rb
CHANGED
@@ -44,7 +44,7 @@ module ThinkNear
|
|
44
44
|
when :get
|
45
45
|
response = @access_token.request(method, endpoint, headers)
|
46
46
|
when :post
|
47
|
-
data = data.to_json
|
47
|
+
data = data.to_json unless data.nil?
|
48
48
|
response = @access_token.request(method, endpoint, data, headers)
|
49
49
|
end
|
50
50
|
|
@@ -63,10 +63,14 @@ module ThinkNear
|
|
63
63
|
if response.body.empty?
|
64
64
|
content = nil
|
65
65
|
else
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
if response.content_type == 'application/json'
|
67
|
+
begin
|
68
|
+
content = JSON.parse(response.body)
|
69
|
+
rescue JSON::ParserError
|
70
|
+
raise DecodeError, "content: <#{response.body}>"
|
71
|
+
end
|
72
|
+
else
|
73
|
+
content = response.body
|
70
74
|
end
|
71
75
|
end
|
72
76
|
|
data/lib/think_near/endpoint.rb
CHANGED
@@ -42,7 +42,11 @@ module ThinkNear
|
|
42
42
|
endpoint_url("offers/#{offer_id}/save") + "?email=#{CGI.escape(email)}"
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
45
|
+
def feed(city)
|
46
|
+
endpoint_url('feeds', 'rss') + "?city=#{CGI.escape(city)}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def endpoint_url(path, format = 'json', version = API_VERSION)
|
46
50
|
["http://#{Client.api_host}", version, [path, format].join('.')].join('/')
|
47
51
|
end
|
48
52
|
end
|
data/thinknear.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{thinknear}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Denis Barushev"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-31}
|
13
13
|
s.email = %q{barushev@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: thinknear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Denis Barushev
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-31 00:00:00 +03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
hash:
|
131
|
+
hash: 1610792489139134683
|
132
132
|
segments:
|
133
133
|
- 0
|
134
134
|
version: "0"
|