gowalla 0.1.3 → 0.1.4

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/Rakefile CHANGED
@@ -14,7 +14,7 @@ begin
14
14
  gem.add_dependency('hashie', '>= 0.1.3')
15
15
  gem.add_dependency('httparty', '>= 0.5.0')
16
16
 
17
- gem.add_development_dependency('thoughtbot-shoulda', '>= 2.10.1')
17
+ gem.add_development_dependency('shoulda', '>= 2.10.1')
18
18
  gem.add_development_dependency('jnunemaker-matchy', '0.4.0')
19
19
  gem.add_development_dependency('fakeweb', '>= 1.2.5')
20
20
  gem.add_development_dependency "yard", ">= 0"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/changelog.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Changelog
2
-
2
+ ## 0.1.4 May 6, 2010
3
+ * Updated accepts header
4
+ * Added patch from [Ruben Fonseca](http://github.com/rubenfonseca) to check in at a spot
3
5
  ## 0.1.3 March 7, 2010
4
6
  * Updated README with correct config call
5
7
  * Applied patch from [Kacy Fortner](http://github.com/kacy) to add vaulted items and missing items calls
data/gowalla.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gowalla}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wynn Netherland"]
12
- s.date = %q{2010-03-07}
12
+ s.date = %q{2010-05-06}
13
13
  s.description = %q{Ruby wrapper for the Gowalla API}
14
14
  s.email = %q{wynn.netherland@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "test/fixtures/categories.json",
31
31
  "test/fixtures/category.json",
32
32
  "test/fixtures/challenges.json",
33
+ "test/fixtures/checkin.json",
33
34
  "test/fixtures/events.json",
34
35
  "test/fixtures/find_spots.json",
35
36
  "test/fixtures/find_trips.json",
@@ -59,7 +60,7 @@ Gem::Specification.new do |s|
59
60
  s.homepage = %q{http://github.com/pengwynn/gowalla}
60
61
  s.rdoc_options = ["--charset=UTF-8"]
61
62
  s.require_paths = ["lib"]
62
- s.rubygems_version = %q{1.3.5}
63
+ s.rubygems_version = %q{1.3.6}
63
64
  s.summary = %q{Ruby wrapper for the Gowalla API}
64
65
  s.test_files = [
65
66
  "test/helper.rb",
@@ -73,14 +74,14 @@ Gem::Specification.new do |s|
73
74
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
74
75
  s.add_runtime_dependency(%q<hashie>, [">= 0.1.3"])
75
76
  s.add_runtime_dependency(%q<httparty>, [">= 0.5.0"])
76
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 2.10.1"])
77
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.1"])
77
78
  s.add_development_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
78
79
  s.add_development_dependency(%q<fakeweb>, [">= 1.2.5"])
79
80
  s.add_development_dependency(%q<yard>, [">= 0"])
80
81
  else
81
82
  s.add_dependency(%q<hashie>, [">= 0.1.3"])
82
83
  s.add_dependency(%q<httparty>, [">= 0.5.0"])
83
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 2.10.1"])
84
+ s.add_dependency(%q<shoulda>, [">= 2.10.1"])
84
85
  s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
85
86
  s.add_dependency(%q<fakeweb>, [">= 1.2.5"])
86
87
  s.add_dependency(%q<yard>, [">= 0"])
@@ -88,7 +89,7 @@ Gem::Specification.new do |s|
88
89
  else
89
90
  s.add_dependency(%q<hashie>, [">= 0.1.3"])
90
91
  s.add_dependency(%q<httparty>, [">= 0.5.0"])
91
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 2.10.1"])
92
+ s.add_dependency(%q<shoulda>, [">= 2.10.1"])
92
93
  s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
93
94
  s.add_dependency(%q<fakeweb>, [">= 1.2.5"])
94
95
  s.add_dependency(%q<yard>, [">= 0"])
data/lib/gowalla.rb CHANGED
@@ -1,9 +1,4 @@
1
- require 'rubygems'
2
-
3
- gem 'hashie', '>= 0.1.3'
4
1
  require 'hashie'
5
-
6
- gem 'httparty', '>= 0.5.0'
7
2
  require 'httparty'
8
3
 
9
4
  directory = File.expand_path(File.dirname(__FILE__))
@@ -4,7 +4,7 @@ module Gowalla
4
4
  include HTTParty
5
5
  format :json
6
6
  base_uri "http://api.gowalla.com"
7
- headers({'Accept' => 'application/json, text/javascript, application/json', "User-Agent" => 'Ruby gem'})
7
+ headers({'Accept' => 'application/json', "User-Agent" => 'Ruby gem'})
8
8
 
9
9
  attr_reader :username
10
10
 
@@ -121,6 +121,12 @@ module Gowalla
121
121
  mashup(self.class.get("/categories/#{id}"))
122
122
  end
123
123
 
124
+ def checkin(spot_id, options = {})
125
+ query = format_geo_options(options)
126
+
127
+ mashup(self.class.post("/checkins", :body => options, :query => { :spot_id => spot_id }))
128
+ end
129
+
124
130
  private
125
131
 
126
132
  def format_geo_options(options={})
@@ -0,0 +1,67 @@
1
+
2
+ {
3
+ "spot":
4
+ {
5
+ "name": "Hospital Distrital Santar\u00e9m",
6
+ "image_url": "http://static.gowalla.com/categories/132-standard.png",
7
+ "url": "/spots/124261"
8
+ },
9
+ "detail_html": "\u003C!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n \"http://www.w3.org/TR/html4/strict.dtd\"\u003E\n\n\u003Chtml lang=\"en\"\u003E\n\u003Chead\u003E\n\t\u003Cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /\u003E\n\t\u003Ctitle\u003EBonus\u003C/title\u003E\n\t\u003Cmeta name=\"author\" content=\"Keegan Jones\"\u003E\n\t\u003Cmeta name=\"viewport\" content=\"width=320; user-scalable=false\" /\u003E \n\t\u003Cstyle type=\"text/css\"\u003E\n\t\t*
10
+ {
11
+ \n\t\t\tpadding: 0;\n\t\t\tmargin: 0;\n\t\t
12
+ }
13
+ \n\n\t\thtml,
14
+ body
15
+ {
16
+ \n\t\t\theight: 100%;\n\t\t
17
+ }
18
+ \n\t\t\n\t\t.gow_item_bonus_wrapper
19
+ {
20
+ \n\t\t\tposition: relative;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t\theight: 100%;\n\t\t\tborder: none;\n\t\t\ttext-align: center;\n\t\t\tfont: 18px \"Helvetica Neue\",
21
+ Arial,
22
+ sans-serif;\n\t\t
23
+ }
24
+ \n\t\t\n\t\t.gow_item_bonus_content
25
+ {
26
+ \n\t\t\tposition: relative;\n\t\t\tmin-height: 100%;\n\t\t
27
+ }
28
+ \n\n\t\t.gow_paging_next
29
+ {
30
+ \n\t\t position: absolute;\n\t\t top: 8px;\n\t\t right: 8px;\n\t\t text-shadow: none;\n\t\t
31
+ }
32
+ \n\t\t\n\t\t.gow_paging_next span
33
+ {
34
+ \n\t\t display: block;\n\t\t height: 44px;\n\t\t padding: 11px 8px 0 0;\n\t\t float: right;\n\t\t color: #f6921e;\n\t\t
35
+ }
36
+ \n\t\t\n\t\t.gow_paging_next a
37
+ {
38
+ \n\t\t display: block;\n\t\t color: #fff;\n\t\t float: right;\n\t\t text-decoration: none;\n\t\t text-shadow: none;\n\t\t font-weight: bold;\n\t\t width: 100px;\n\t\t height: 44px;\n\t\t\tmargin-left: 8px;\n\t\t line-height: 44px;\n\t\t background: #f6921e;\n\t\t -webkit-border-radius: 6px;\n\t\t -moz-border-radius: 6px;\n\t\t
39
+ }
40
+ \n\t\t\n\t\t.gow_paging_next a:active
41
+ {
42
+ \n\t\t background: #d67300;\n\t\t
43
+ }
44
+ \n\t\t\n\t\t.gow_paging_next a em
45
+ {
46
+ \n\t\t display: block;\n\t\t font-style: normal;\n\t\t padding: 10px 18px;\n\t\t
47
+ }
48
+ \n\t\t\n\t\u003C/style\u003E\n\t\u003Cscript type=\"text/javascript\" charset=\"utf-8\"\u003E\n\t\tfunction gowallaHtmlViewBonusNextPage(currentPageNum)
49
+ {
50
+ \n\t\t\tdocument.getElementById('gow_bonus_html_page_'+currentPageNum).style.display = 'none';\n\t\t\t++currentPageNum;\n\t\t\tdocument.getElementById('gow_bonus_html_page_'+currentPageNum).style.display = 'block';\n\t\t
51
+ }
52
+ \n\t\tfunction gowallaHtmlViewBonusBackPage(currentPageNum)
53
+ {
54
+ \n\t\t\tdocument.getElementById('gow_bonus_html_page_'+currentPageNum).style.display = 'none';\n\t\t\t--currentPageNum;\n\t\t\tdocument.getElementById('gow_bonus_html_page_'+currentPageNum).style.display = 'block';\n\t\t
55
+ }
56
+ \n\t\u003C/script\u003E\n\u003C/head\u003E\n\u003Cbody\u003E\n\t\n\t\t\u003Cdiv class=\"gow_item_bonus_wrapper\" id=\"gow_bonus_html_page_0\" style=\"display: block;\"\u003E\n\t\t\t\u003Cdiv class=\"gow_item_bonus_content\" style=\"background: #ebf2dd url(/images/iphone/bg-stripes.png) top left repeat;\"\u003E\n\t\u003Cdiv id=\"gow_bonus_wrapper\" style=\"position: relative;\n\tcolor: #333;\n\toverflow: hidden;\n\ttext-align: center;\n\ttext-shadow: #fff 0px 1px 1px;\n\tfont: 18px 'Helvetica Neue',
57
+ Arial,
58
+ sans-serif;\"\u003E\n\t\t\u003Cdiv id=\"gow_bonus_stats\" style=\"position: relative: overflow: hidden;\"\u003E\n\t\t\t\u003Cimg height=\"100\" width=\"100\" src=\"http://static.gowalla.com/categories/132-standard.png\" id=\"gow_bonus_stamp\" style=\"margin-top: 70px;\" /\u003E\n\t\t\t\u003Cp\u003E\u003Cem style=\"font-weight: bold;font-style: normal;\"\u003EHospital Distrital Santar\u00e9m\u003C/em\u003E\u003C/p\u003E\n\t\t\t\u003Cp\u003EThis is your \u003Cspan style=\"color: #f6921e;font-weight: bold;\"\u003E2nd\u003C/span\u003E check-in here!\u003C/p\u003E\n\n\t\t\t\u003Cdiv id=\"gow_bonus_meta\" style=\"background: #fff;\n\t\t\t-webkit-border-radius: 6px;\n\t\t\t-moz-border-radius: 6px;\n\t\t\tfont-size: 13px;\n\t\t\ttext-align: left;\n\t\t\ttext-shadow: none;\n\t\t\tcolor: #5a6d37;\n\t\t\tline-height: 15px;\n\t\t\tdisplay: block;\n\t\t\tmargin: 8px;\n\t\t\tmargin-bottom: 20px;\"\u003E\n\n\t\t\t\t\n\t\t\n\t\t\n\t\t\t\t\n\t\t\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\u003C/div\u003E\n\t\t\u003C/div\u003E\n\t\u003C/div\u003E\n\u003C/div\u003E\n\t\t\t\n\t\t\u003C/div\u003E\n\t\n\u003C/body\u003E\n\u003C/html\u003E\n",
59
+ "created_at": "2010-03-11T23:01:49+00:00",
60
+ "activity_url": "/checkins/4604798/activity",
61
+ "user":
62
+ {
63
+ "url": "/users/73842"
64
+ },
65
+ "url": "/checkins/4604798"
66
+ }
67
+
data/test/test_gowalla.rb CHANGED
@@ -276,9 +276,10 @@ class TestGowalla < Test::Unit::TestCase
276
276
  # BODY lat=33.23404216&name=TreeFrog%20Studios&category_url=/categories/217&description=Children%20and%20family%20photography%20studio&lng=-96.95513802000001
277
277
  end
278
278
 
279
- should_eventually "check in at a spot" do
280
- # POST http://api.gowalla.com/visits?spot_id=472093
281
- # BODY fb_id=605681706&lat=33.23404216&accuracy=2055&post_to_facebook=0&fb_session_key=976e56d6baa517cfe77eadfc-605681706&lng=-96.95513802000001&comment=Testing%20Gowalla%20API%20&post_to_twitter=1
279
+ should "check in at a spot" do
280
+ stub_post("http://pengwynn:0U812@api.gowalla.com/checkins?spot_id=124261", "checkin.json")
281
+ checkin = @client.checkin(124261, :lat => 39.24180603027344, :lng => -8.695899963378906)
282
+ checkin.detail_html.should_not be_nil
282
283
  end
283
284
 
284
285
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gowalla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 4
9
+ version: 0.1.4
5
10
  platform: ruby
6
11
  authors:
7
12
  - Wynn Netherland
@@ -9,69 +14,91 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-03-07 00:00:00 -06:00
17
+ date: 2010-05-06 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: hashie
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 1
30
+ - 3
23
31
  version: 0.1.3
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: httparty
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 5
44
+ - 0
33
45
  version: 0.5.0
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
- name: thoughtbot-shoulda
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
49
+ name: shoulda
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 2
57
+ - 10
58
+ - 1
43
59
  version: 2.10.1
44
- version:
60
+ type: :development
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: jnunemaker-matchy
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - "="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ - 4
72
+ - 0
53
73
  version: 0.4.0
54
- version:
74
+ type: :development
75
+ version_requirements: *id004
55
76
  - !ruby/object:Gem::Dependency
56
77
  name: fakeweb
57
- type: :development
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
60
80
  requirements:
61
81
  - - ">="
62
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 1
85
+ - 2
86
+ - 5
63
87
  version: 1.2.5
64
- version:
88
+ type: :development
89
+ version_requirements: *id005
65
90
  - !ruby/object:Gem::Dependency
66
91
  name: yard
67
- type: :development
68
- version_requirement:
69
- version_requirements: !ruby/object:Gem::Requirement
92
+ prerelease: false
93
+ requirement: &id006 !ruby/object:Gem::Requirement
70
94
  requirements:
71
95
  - - ">="
72
96
  - !ruby/object:Gem::Version
97
+ segments:
98
+ - 0
73
99
  version: "0"
74
- version:
100
+ type: :development
101
+ version_requirements: *id006
75
102
  description: Ruby wrapper for the Gowalla API
76
103
  email: wynn.netherland@gmail.com
77
104
  executables: []
@@ -95,6 +122,7 @@ files:
95
122
  - test/fixtures/categories.json
96
123
  - test/fixtures/category.json
97
124
  - test/fixtures/challenges.json
125
+ - test/fixtures/checkin.json
98
126
  - test/fixtures/events.json
99
127
  - test/fixtures/find_spots.json
100
128
  - test/fixtures/find_trips.json
@@ -133,18 +161,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
161
  requirements:
134
162
  - - ">="
135
163
  - !ruby/object:Gem::Version
164
+ segments:
165
+ - 0
136
166
  version: "0"
137
- version:
138
167
  required_rubygems_version: !ruby/object:Gem::Requirement
139
168
  requirements:
140
169
  - - ">="
141
170
  - !ruby/object:Gem::Version
171
+ segments:
172
+ - 0
142
173
  version: "0"
143
- version:
144
174
  requirements: []
145
175
 
146
176
  rubyforge_project:
147
- rubygems_version: 1.3.5
177
+ rubygems_version: 1.3.6
148
178
  signing_key:
149
179
  specification_version: 3
150
180
  summary: Ruby wrapper for the Gowalla API