rdioid 0.0.3 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f8b63dcc16df01167fee9c8c07702dbebe3141d
4
- data.tar.gz: f3993d9d7e610c881e687669c7c01c813d8824e8
3
+ metadata.gz: 92ad9d720f318c61bec6a12e928245487533593b
4
+ data.tar.gz: 33194807ec2607b86800a85601ba8012e94022f8
5
5
  SHA512:
6
- metadata.gz: 5b578278e0c8c7e4f310c380b7813601386d7609d633017745cac2e1c934bfc05ec1f28767699f1dd052e6e059ecc9c77fa6ab112a580243c38b86f47c3c371a
7
- data.tar.gz: d23962e4e07e5c2d2314719c001e7b4edf923699242d4883cec594275df94ddb3338aee6eb18d800604eb2e1b3de40303db8068853138ba912b70287a8e4dee0
6
+ metadata.gz: fe58ed8a6a93304f551684dd8193affe7cab1c9f0054d5e871bc53988f336e426d9e28a078e78b033fa4ba019a0007c2f4e2b624ecf1b41f34569802fbfb9912
7
+ data.tar.gz: 8c955bf2d33b217f0fc57db12495f1c7557471614b0a7a1d16a6f5077fae355a272122ac277a29df7b0c4efea34610994223a8bc55c557a3280c75050bea1f29
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
- before_install: gem install bundler -v 1.10.5
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/README.md CHANGED
@@ -68,7 +68,7 @@ rdioid_client.request_device_code
68
68
 
69
69
  code = '2479RA'
70
70
 
71
- # poll this method at a rate of "interval_s", waiting for a response without an "error"
71
+ # poll this method at a rate of "interval_s", waiting for a response with an "access_token"
72
72
  #
73
73
  rdioid_client.request_token_with_device_code(code)
74
74
  # => { "error_description" => "user has not approved this code yet", "error" => "pending_authorization" }
data/lib/rdioid/client.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Rdioid
2
- # Once *Rdioid* is configured with all required values, *Rdioid::Client* is
2
+ # Once *Rdioid* is configured with all required values, <b>Rdioid::Client</b> is
3
3
  # able to make requests to the <b>Web Service API</b>.
4
4
  class Client
5
5
  ##
@@ -53,11 +53,10 @@ module Rdioid
53
53
  # # => http://test.com/#state=new_user&error=access_denied
54
54
  #
55
55
  def self.authorization_url(options = {})
56
- query = {
57
- :response_type => 'code',
58
- :client_id => Rdioid.config.client_id,
59
- :redirect_uri => Rdioid.config.redirect_uri
60
- }.merge(options)
56
+ query = { :response_type => 'code' }.merge(options)
57
+
58
+ query[:client_id] = Rdioid.config.client_id
59
+ query[:redirect_uri] = Rdioid.config.redirect_uri
61
60
 
62
61
  authorization_query = HTTP::Message.escape_query(query)
63
62
 
@@ -113,8 +112,8 @@ module Rdioid
113
112
  ##
114
113
  # Requests an OAuth +device_code+ for the <b>Device Code Grant</b>.
115
114
  #
116
- # @param options [Hash] additional request values
117
- # @option options [String] :scope the desired scope you wish to have access to
115
+ # @param body [Hash] additional request values
116
+ # @option body [String] :scope the desired scope you wish to have access to
118
117
  #
119
118
  # @return [Hash] response from the Web Service API
120
119
  #
@@ -124,10 +123,8 @@ module Rdioid
124
123
  # rdioid_client.request_device_code
125
124
  # # => { "expires_in_s" => 1800, "device_code" => "2479RA", "interval_s" => 5, "verification_url" => "rdio.com/device" }
126
125
  #
127
- def request_device_code(options = {})
128
- body = {
129
- :client_id => Rdioid.config.client_id,
130
- }.merge(options)
126
+ def request_device_code(body = {})
127
+ body[:client_id] = Rdioid.config.client_id
131
128
 
132
129
  request(Rdioid::OAUTH_DEVICE_CODE_ENDPOINT, :body => body)
133
130
  end
@@ -136,8 +133,8 @@ module Rdioid
136
133
  # Requests an OAuth +access_token+ using the <b>Authorization Code Grant</b>.
137
134
  #
138
135
  # @param code [String] OAuth code received from the +.authorization_url+ redirect
139
- # @param options [Hash] additional request values
140
- # @option options [String] :scope the desired scope you wish to have access to
136
+ # @param body [Hash] additional request values
137
+ # @option body [String] :scope the desired scope you wish to have access to
141
138
  #
142
139
  # @return [Hash] response from the Web Service API
143
140
  #
@@ -151,12 +148,10 @@ module Rdioid
151
148
  # rdioid_client.request_token_with_authorization_code(code)
152
149
  # # => { "error_description" => "unknown authorization code ImSLMoN02mqBkO", "error" => "invalid_grant" }
153
150
  #
154
- def request_token_with_authorization_code(code, options = {})
155
- body = {
156
- :grant_type => 'authorization_code',
157
- :code => code,
158
- :redirect_uri => Rdioid.config.redirect_uri
159
- }.merge(options)
151
+ def request_token_with_authorization_code(code, body = {})
152
+ body[:grant_type] = 'authorization_code'
153
+ body[:code] = code
154
+ body[:redirect_uri] = Rdioid.config.redirect_uri
160
155
 
161
156
  request(Rdioid::OAUTH_TOKEN_ENDPOINT, :body => body)
162
157
  end
@@ -164,8 +159,8 @@ module Rdioid
164
159
  ##
165
160
  # Requests an OAuth +access_token+ using the <b>Client Credentials</b>.
166
161
  #
167
- # @param options [Hash] additional request values
168
- # @option options [String] :scope the desired scope you wish to have access to
162
+ # @param body [Hash] additional request values
163
+ # @option body [String] :scope the desired scope you wish to have access to
169
164
  #
170
165
  # @return [Hash] response from the Web Service API
171
166
  #
@@ -175,10 +170,8 @@ module Rdioid
175
170
  # rdioid_client.request_token_with_client_credentials
176
171
  # # => { "access_token" => "AAAdmanFxdWxlayip", "token_type" => "bearer", "expires_in" => 43200, "scope" => "" }
177
172
  #
178
- def request_token_with_client_credentials(options = {})
179
- body = {
180
- :grant_type => 'client_credentials'
181
- }.merge(options)
173
+ def request_token_with_client_credentials(body = {})
174
+ body[:grant_type] = 'client_credentials'
182
175
 
183
176
  request(Rdioid::OAUTH_TOKEN_ENDPOINT, :body => body)
184
177
  end
@@ -187,8 +180,8 @@ module Rdioid
187
180
  # Requests an OAuth +access_token+ using the <b>Device Code Grant</b>.
188
181
  #
189
182
  # @param device_code [String] +device_code+ received from calling +#request_device_code+
190
- # @param options [Hash] additional request values
191
- # @option options [String] :scope the desired scope you wish to have access to
183
+ # @param body [Hash] additional request values
184
+ # @option body [String] :scope the desired scope you wish to have access to
192
185
  #
193
186
  # @return [Hash] response from the Web Service API
194
187
  #
@@ -205,11 +198,9 @@ module Rdioid
205
198
  # rdioid_client.request_token_with_device_code(device_code)
206
199
  # # => { "error_description" => "no entry found for given device_code", "error" => "invalid_request" }
207
200
  #
208
- def request_token_with_device_code(device_code, options = {})
209
- body = {
210
- :grant_type => 'device_code',
211
- :device_code => device_code
212
- }.merge(options)
201
+ def request_token_with_device_code(device_code, body = {})
202
+ body[:grant_type] = 'device_code'
203
+ body[:device_code] = device_code
213
204
 
214
205
  request(Rdioid::OAUTH_TOKEN_ENDPOINT, :body => body)
215
206
  end
@@ -219,8 +210,8 @@ module Rdioid
219
210
  #
220
211
  # @param username [String] email address for the User
221
212
  # @param password [String] password for the User
222
- # @param options [Hash] additional request values
223
- # @option options [String] :scope the desired scope you wish to have access to
213
+ # @param body [Hash] additional request values
214
+ # @option body [String] :scope the desired scope you wish to have access to
224
215
  #
225
216
  # @return [Hash] response from the Web Service API
226
217
  #
@@ -235,12 +226,10 @@ module Rdioid
235
226
  # rdioid_client.request_token_with_password(username, password)
236
227
  # # => { "error_description" => "This client is not authorized to use the password grant", "error" => "unauthorized_client" }
237
228
  #
238
- def request_token_with_password(username, password, options = {})
239
- body = {
240
- :grant_type => 'password',
241
- :username => username,
242
- :password => password
243
- }.merge(options)
229
+ def request_token_with_password(username, password, body = {})
230
+ body[:grant_type] = 'password'
231
+ body[:username] = username
232
+ body[:password] = password
244
233
 
245
234
  request(Rdioid::OAUTH_TOKEN_ENDPOINT, :body => body)
246
235
  end
@@ -249,8 +238,8 @@ module Rdioid
249
238
  # Requests an OAuth +access_token+ using the <b>Refresh Token</b>.
250
239
  #
251
240
  # @param refresh_token [String] refresh token previously issued during an +access_token+ request
252
- # @param options [Hash] additional request values
253
- # @option options [String] :scope the desired scope you wish to have access to
241
+ # @param body [Hash] additional request values
242
+ # @option body [String] :scope the desired scope you wish to have access to
254
243
  #
255
244
  # @return [Hash] response from the Web Service API
256
245
  #
@@ -264,11 +253,9 @@ module Rdioid
264
253
  # rdioid_client.request_token_with_refresh_token(refresh_token)
265
254
  # # => { "error_description" => "invalid refresh token", "error" => "invalid_grant" }
266
255
  #
267
- def request_token_with_refresh_token(refresh_token, options = {})
268
- body = {
269
- :grant_type => 'refresh_token',
270
- :refresh_token => refresh_token
271
- }.merge(options)
256
+ def request_token_with_refresh_token(refresh_token, body = {})
257
+ body[:grant_type] = 'refresh_token'
258
+ body[:refresh_token] = refresh_token
272
259
 
273
260
  request(Rdioid::OAUTH_TOKEN_ENDPOINT, :body => body)
274
261
  end
@@ -1,3 +1,3 @@
1
1
  module Rdioid
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/rdioid.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Brent Redd"]
10
10
  spec.email = ["reddshack@gmail.com"]
11
11
 
12
- spec.summary = %q{Simple Rdio Web Services API wrapper with OAuth 2.0}
13
- spec.description = %q{Handles OAuth 2.0 authentication and API calls for Rdio Web Services API.}
12
+ spec.summary = %q{Simple Rdio Web Service API wrapper with OAuth 2.0}
13
+ spec.description = %q{Handles OAuth 2.0 authentication and API calls for Rdio Web Service API.}
14
14
  spec.homepage = "https://github.com/reddshack/rdioid"
15
15
  spec.license = "MIT"
16
16
 
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.10"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdioid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Redd
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-27 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -56,18 +56,17 @@ dependencies:
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
69
- description: Handles OAuth 2.0 authentication and API calls for Rdio Web Services
70
- API.
68
+ version: '3.0'
69
+ description: Handles OAuth 2.0 authentication and API calls for Rdio Web Service API.
71
70
  email:
72
71
  - reddshack@gmail.com
73
72
  executables: []
@@ -108,9 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
107
  version: '0'
109
108
  requirements: []
110
109
  rubyforge_project:
111
- rubygems_version: 2.4.8
110
+ rubygems_version: 2.4.5.1
112
111
  signing_key:
113
112
  specification_version: 4
114
- summary: Simple Rdio Web Services API wrapper with OAuth 2.0
113
+ summary: Simple Rdio Web Service API wrapper with OAuth 2.0
115
114
  test_files: []
116
115
  has_rdoc: