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 CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -59,6 +59,10 @@ module ThinkNear
59
59
  post Endpoint.save_offer(offer_id, email)
60
60
  end
61
61
 
62
+ def get_feed(city)
63
+ get Endpoint.feed(city)
64
+ end
65
+
62
66
  def get(endpoint, data=nil)
63
67
  raise NoConnectionEstablished if @@connection.nil?
64
68
  @@connection.get endpoint, data
@@ -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 unless data.nil?
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
- begin
67
- content = JSON.parse(response.body)
68
- rescue JSON::ParserError
69
- raise DecodeError, "content: <#{response.body}>"
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
 
@@ -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 endpoint_url(path, version = API_VERSION, format = 'json')
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"
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-28}
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.8
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-28 00:00:00 +03:00
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: 3290331615421976596
131
+ hash: 1610792489139134683
132
132
  segments:
133
133
  - 0
134
134
  version: "0"