geoloqi 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,8 +42,8 @@ module Geoloqi
42
42
  def run(meth, path, body=nil)
43
43
  renew_access_token! if auth[:expires_at] && auth[:expires_at] <= Time.now
44
44
 
45
- body = body.to_json if body.is_a? Hash
46
-
45
+ body = body.to_json if [Hash, Array].include? body.class
46
+
47
47
  retry_attempt = 0
48
48
  begin
49
49
  response = @connection.send(meth) do |req|
@@ -120,4 +120,4 @@ module Geoloqi
120
120
  headers
121
121
  end
122
122
  end
123
- end
123
+ end
@@ -1,3 +1,3 @@
1
1
  module Geoloqi
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
data/spec/geoloqi_spec.rb CHANGED
@@ -44,7 +44,7 @@ describe Geoloqi::Session do
44
44
  before do
45
45
  WebMock.allow_net_connect!
46
46
  end
47
-
47
+
48
48
  describe 'with nothing passed' do
49
49
  before do
50
50
  @session = Geoloqi::Session.new
@@ -60,13 +60,17 @@ describe Geoloqi::Session do
60
60
  @session = Geoloqi::Session.new :access_token => ARGV[2]
61
61
  end
62
62
 
63
+ it 'successfully makes mock call with array' do
64
+ expect { @session.post('play_record_at_geoloqi_hq', [{:artist => 'Television'}])['result'] == 'ok' }
65
+ end
66
+
63
67
  it 'successfully makes call to api with forward slash' do
64
68
  response = @session.get '/layer/info/Gx'
65
69
  expect { response['layer_id'] == 'Gx' }
66
70
  end
67
71
 
68
72
  it 'successfully makes call to api without forward slash' do
69
- response = @session.get '/layer/info/Gx'
73
+ response = @session.get 'layer/info/Gx'
70
74
  expect { response['layer_id'] == 'Gx' }
71
75
  end
72
76
 
@@ -157,7 +161,7 @@ describe Geoloqi::Session do
157
161
  :refresh_token => 'refresh_token1234'} }
158
162
  end
159
163
  end
160
-
164
+
161
165
  describe 'with config and expired auth' do
162
166
  before do
163
167
  @session = Geoloqi::Session.new :config => {:client_id => ARGV[0], :client_secret => ARGV[1]},
@@ -167,7 +171,7 @@ describe Geoloqi::Session do
167
171
  :expires_at => Time.at(0),
168
172
  :refresh_token => 'refresh_token1234' }
169
173
  end
170
-
174
+
171
175
  it 'retrieves new access token and retries query if expired' do
172
176
  WebMock.disable_net_connect!
173
177
  begin
@@ -208,4 +212,10 @@ stub_request(:post, "https://api.geoloqi.com/1/oauth/token").
208
212
  stub_request(:get, "https://api.geoloqi.com/1/account/username").
209
213
  with(:headers => {'Authorization'=>'OAuth access_token4567'}).
210
214
  to_return(:status => 200,
211
- :body => {'username' => 'pikachu4lyfe'}.to_json)
215
+ :body => {'username' => 'pikachu4lyfe'}.to_json)
216
+
217
+ # This is not a real API call, we're using it to test that arrays are JSON encoded.
218
+ stub_request(:post, "https://api.geoloqi.com/1/play_record_at_geoloqi_hq").
219
+ with(:body => [{:artist => 'Television'}].to_json).
220
+ to_return(:status => 200,
221
+ :body => {'result' => 'ok'}.to_json)
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoloqi
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 63
4
5
  prerelease:
5
- version: 0.9.1
6
+ segments:
7
+ - 0
8
+ - 9
9
+ - 2
10
+ version: 0.9.2
6
11
  platform: ruby
7
12
  authors:
8
13
  - Kyle Drake
@@ -11,7 +16,7 @@ autorequire:
11
16
  bindir: bin
12
17
  cert_chain: []
13
18
 
14
- date: 2011-06-05 00:00:00 -07:00
19
+ date: 2011-06-06 00:00:00 -07:00
15
20
  default_executable:
16
21
  dependencies:
17
22
  - !ruby/object:Gem::Dependency
@@ -22,6 +27,9 @@ dependencies:
22
27
  requirements:
23
28
  - - ">="
24
29
  - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
25
33
  version: "0"
26
34
  type: :runtime
27
35
  version_requirements: *id001
@@ -33,6 +41,9 @@ dependencies:
33
41
  requirements:
34
42
  - - ">="
35
43
  - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
36
47
  version: "0"
37
48
  type: :runtime
38
49
  version_requirements: *id002
@@ -44,6 +55,11 @@ dependencies:
44
55
  requirements:
45
56
  - - "="
46
57
  - !ruby/object:Gem::Version
58
+ hash: 11
59
+ segments:
60
+ - 0
61
+ - 5
62
+ - 0
47
63
  version: 0.5.0
48
64
  type: :development
49
65
  version_requirements: *id003
@@ -55,6 +71,11 @@ dependencies:
55
71
  requirements:
56
72
  - - "="
57
73
  - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 2
77
+ - 2
78
+ - 2
58
79
  version: 2.2.2
59
80
  type: :development
60
81
  version_requirements: *id004
@@ -66,6 +87,11 @@ dependencies:
66
87
  requirements:
67
88
  - - "="
68
89
  - !ruby/object:Gem::Version
90
+ hash: 7
91
+ segments:
92
+ - 1
93
+ - 6
94
+ - 4
69
95
  version: 1.6.4
70
96
  type: :development
71
97
  version_requirements: *id005
@@ -108,12 +134,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
134
  requirements:
109
135
  - - ">="
110
136
  - !ruby/object:Gem::Version
137
+ hash: 3
138
+ segments:
139
+ - 0
111
140
  version: "0"
112
141
  required_rubygems_version: !ruby/object:Gem::Requirement
113
142
  none: false
114
143
  requirements:
115
144
  - - ">="
116
145
  - !ruby/object:Gem::Version
146
+ hash: 19
147
+ segments:
148
+ - 1
149
+ - 3
150
+ - 4
117
151
  version: 1.3.4
118
152
  requirements: []
119
153