thinknear 0.0.9 → 0.0.11

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.11
@@ -35,7 +35,11 @@ module ThinkNear
35
35
  end
36
36
 
37
37
  def claim_offer(offer_id, latitude, longitude)
38
- endpoint_url "offers/#{offer_id}/claim/#{latitude},#{longitude}"
38
+ if latitude && longitude
39
+ endpoint_url "offers/#{offer_id}/claim/#{latitude},#{longitude}"
40
+ else
41
+ endpoint_url "offers/#{offer_id}/claim"
42
+ end
39
43
  end
40
44
 
41
45
  def save_offer(offer_id, email)
@@ -2,9 +2,13 @@ module ThinkNear
2
2
  class Offer < OpenStruct
3
3
  def self.find(id_or_params)
4
4
  if id_or_params.is_a? String
5
- if params = Client.get_offer(id_or_params)['offer']
6
- new(params)
7
- else
5
+ begin
6
+ if params = Client.get_offer(id_or_params)['offer']
7
+ new(params)
8
+ else
9
+ raise OfferNotFound, "Couldn't find Offer with ID=#{id_or_params}"
10
+ end
11
+ rescue NotFound
8
12
  raise OfferNotFound, "Couldn't find Offer with ID=#{id_or_params}"
9
13
  end
10
14
  elsif id_or_params.is_a? Hash
@@ -18,7 +22,7 @@ module ThinkNear
18
22
  @table
19
23
  end
20
24
 
21
- def claim!(latitude, longitude)
25
+ def claim!(latitude = nil, longitude = nil)
22
26
  self.class.new Client.claim_offer(id, latitude, longitude)['offer']
23
27
  end
24
28
 
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.9"
8
+ s.version = "0.0.11"
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-31}
12
+ s.date = %q{2011-04-04}
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.9
5
+ version: 0.0.11
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-31 00:00:00 +03:00
13
+ date: 2011-04-04 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: 1610792489139134683
131
+ hash: 4151620768445571141
132
132
  segments:
133
133
  - 0
134
134
  version: "0"