tangerine 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/tangerine/backlot.rb +8 -0
- data/spec/tangerine/backlot_spec.rb +44 -24
- data/tangerine.gemspec +3 -4
- metadata +77 -77
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
data/lib/tangerine/backlot.rb
CHANGED
@@ -5,6 +5,8 @@ require 'digest/sha2'
|
|
5
5
|
module Tangerine
|
6
6
|
module Backlot
|
7
7
|
|
8
|
+
class NotAuthenticatedError < RuntimeError; end
|
9
|
+
|
8
10
|
class HTTP
|
9
11
|
include HTTParty
|
10
12
|
base_uri 'http://api.ooyala.com/partner'
|
@@ -19,6 +21,8 @@ module Tangerine
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def self.get(request_type, params={})
|
24
|
+
raise NotAuthenticatedError unless self.authenticated?
|
25
|
+
|
22
26
|
params['expires'] ||= (Time.now.to_i + 10).to_s
|
23
27
|
params['signature'] = self.signature(params)
|
24
28
|
HTTP.get(request_type, {:query => params})
|
@@ -32,6 +36,10 @@ module Tangerine
|
|
32
36
|
Base64::encode64(digest).chomp.gsub(/=+$/, '')
|
33
37
|
end
|
34
38
|
|
39
|
+
def self.authenticated?
|
40
|
+
@secret && HTTP.default_params[:pcode]
|
41
|
+
end
|
42
|
+
|
35
43
|
end
|
36
44
|
|
37
45
|
end
|
@@ -1,44 +1,64 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Tangerine::Backlot do
|
4
|
-
authenticate!
|
5
4
|
|
6
|
-
describe
|
7
|
-
|
8
|
-
its(:base_uri) { should == 'http://api.ooyala.com/partner' }
|
9
|
-
end
|
10
|
-
|
11
|
-
describe Tangerine::Backlot::API do
|
12
|
-
context 'class methods' do
|
5
|
+
describe 'when not authenticated' do
|
6
|
+
describe Tangerine::Backlot::API do
|
13
7
|
subject { Tangerine::Backlot::API }
|
14
8
|
|
9
|
+
its(:authenticated?) { should be_false }
|
10
|
+
|
15
11
|
describe '.get' do
|
12
|
+
it 'complains about not yet being authenticated' do
|
13
|
+
expect{ subject.get('/query') }.should raise_error(Tangerine::Backlot::NotAuthenticatedError)
|
14
|
+
end
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
end
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
subject.get(request).should == response
|
23
|
-
end
|
20
|
+
describe 'when authenticated' do
|
21
|
+
authenticate!
|
24
22
|
|
25
|
-
|
23
|
+
describe Tangerine::Backlot::HTTP do
|
24
|
+
subject { Tangerine::Backlot::HTTP }
|
25
|
+
its(:base_uri) { should == 'http://api.ooyala.com/partner' }
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
describe Tangerine::Backlot::API do
|
29
|
+
context 'class methods' do
|
30
|
+
subject { Tangerine::Backlot::API }
|
31
|
+
|
32
|
+
its(:authenticated?) { should be_true }
|
33
|
+
|
34
|
+
describe '.get' do
|
35
|
+
|
36
|
+
let(:response) { mock }
|
37
|
+
let(:request) { '/some-request-path' }
|
38
|
+
|
39
|
+
it 'returns the HTTP response' do
|
40
|
+
Tangerine::Backlot::HTTP.should_receive(:get).and_return(response)
|
41
|
+
subject.get(request).should == response
|
31
42
|
end
|
32
|
-
subject { Tangerine::Backlot::HTTP }
|
33
43
|
|
34
|
-
|
35
|
-
|
36
|
-
|
44
|
+
context 'when making subsequent requests' do
|
45
|
+
|
46
|
+
let(:original_params) { { 'contentType' => 'Channel' } }
|
47
|
+
before do
|
48
|
+
Tangerine::Backlot::HTTP.stub(:get)
|
49
|
+
Tangerine::Backlot::API.get('/query', original_params)
|
50
|
+
end
|
51
|
+
subject { Tangerine::Backlot::HTTP }
|
52
|
+
|
53
|
+
it 'clears parameters before the new request' do
|
54
|
+
Tangerine::Backlot::API.get('/channel_sets', 'mode' => 'list')
|
55
|
+
subject.default_params.keys.should_not include('contentType')
|
56
|
+
end
|
37
57
|
end
|
58
|
+
|
38
59
|
end
|
39
60
|
|
40
61
|
end
|
41
|
-
|
42
62
|
end
|
43
63
|
end
|
44
64
|
|
data/tangerine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tangerine}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Anthony Navarre", "Craig Williams"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-12}
|
13
13
|
s.description = %q{Ooyala Backlot API Wrapper. Read more about the Ooyala Backlot API at http://www.ooyala.com/support/docs/backlot_api}
|
14
14
|
s.email = %q{anthony.navarre@factorylabs.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
s.homepage = %q{http://github.com/factorylabs/tangerine}
|
56
56
|
s.licenses = ["MIT"]
|
57
57
|
s.require_paths = ["lib"]
|
58
|
-
s.rubygems_version = %q{1.
|
58
|
+
s.rubygems_version = %q{1.6.0}
|
59
59
|
s.summary = %q{Ooyala Backlot API Wrapper}
|
60
60
|
s.test_files = [
|
61
61
|
"spec/spec_helper.rb",
|
@@ -72,7 +72,6 @@ Gem::Specification.new do |s|
|
|
72
72
|
]
|
73
73
|
|
74
74
|
if s.respond_to? :specification_version then
|
75
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
76
75
|
s.specification_version = 3
|
77
76
|
|
78
77
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tangerine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Anthony Navarre
|
@@ -16,14 +16,11 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-12 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
|
-
|
24
|
-
type: :runtime
|
25
|
-
name: httparty
|
26
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
24
|
none: false
|
28
25
|
requirements:
|
29
26
|
- - ~>
|
@@ -34,12 +31,12 @@ dependencies:
|
|
34
31
|
- 7
|
35
32
|
- 4
|
36
33
|
version: 0.7.4
|
37
|
-
|
38
|
-
|
34
|
+
version_requirements: *id001
|
35
|
+
name: httparty
|
39
36
|
prerelease: false
|
40
37
|
type: :runtime
|
41
|
-
|
42
|
-
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
40
|
none: false
|
44
41
|
requirements:
|
45
42
|
- - ~>
|
@@ -50,12 +47,12 @@ dependencies:
|
|
50
47
|
- 0
|
51
48
|
- 5
|
52
49
|
version: 3.0.5
|
53
|
-
|
54
|
-
|
50
|
+
version_requirements: *id002
|
51
|
+
name: activesupport
|
55
52
|
prerelease: false
|
56
53
|
type: :runtime
|
57
|
-
|
58
|
-
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
56
|
none: false
|
60
57
|
requirements:
|
61
58
|
- - ">="
|
@@ -66,12 +63,12 @@ dependencies:
|
|
66
63
|
- 4
|
67
64
|
- 6
|
68
65
|
version: 1.4.6
|
69
|
-
|
70
|
-
|
66
|
+
version_requirements: *id003
|
67
|
+
name: json
|
71
68
|
prerelease: false
|
72
69
|
type: :runtime
|
73
|
-
|
74
|
-
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
73
|
requirements:
|
77
74
|
- - ~>
|
@@ -82,12 +79,12 @@ dependencies:
|
|
82
79
|
- 5
|
83
80
|
- 0
|
84
81
|
version: 0.5.0
|
85
|
-
|
86
|
-
|
82
|
+
version_requirements: *id004
|
83
|
+
name: i18n
|
87
84
|
prerelease: false
|
88
|
-
type: :
|
89
|
-
|
90
|
-
|
85
|
+
type: :runtime
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
91
88
|
none: false
|
92
89
|
requirements:
|
93
90
|
- - ~>
|
@@ -98,12 +95,12 @@ dependencies:
|
|
98
95
|
- 3
|
99
96
|
- 0
|
100
97
|
version: 2.3.0
|
101
|
-
|
102
|
-
|
98
|
+
version_requirements: *id005
|
99
|
+
name: rspec
|
103
100
|
prerelease: false
|
104
101
|
type: :development
|
105
|
-
|
106
|
-
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
107
104
|
none: false
|
108
105
|
requirements:
|
109
106
|
- - ~>
|
@@ -114,12 +111,12 @@ dependencies:
|
|
114
111
|
- 6
|
115
112
|
- 0
|
116
113
|
version: 0.6.0
|
117
|
-
|
118
|
-
|
114
|
+
version_requirements: *id006
|
115
|
+
name: yard
|
119
116
|
prerelease: false
|
120
117
|
type: :development
|
121
|
-
|
122
|
-
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
123
120
|
none: false
|
124
121
|
requirements:
|
125
122
|
- - ~>
|
@@ -130,12 +127,12 @@ dependencies:
|
|
130
127
|
- 0
|
131
128
|
- 0
|
132
129
|
version: 1.0.0
|
133
|
-
|
134
|
-
|
130
|
+
version_requirements: *id007
|
131
|
+
name: bundler
|
135
132
|
prerelease: false
|
136
133
|
type: :development
|
137
|
-
|
138
|
-
|
134
|
+
- !ruby/object:Gem::Dependency
|
135
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
139
136
|
none: false
|
140
137
|
requirements:
|
141
138
|
- - ~>
|
@@ -146,12 +143,12 @@ dependencies:
|
|
146
143
|
- 5
|
147
144
|
- 2
|
148
145
|
version: 1.5.2
|
149
|
-
|
150
|
-
|
146
|
+
version_requirements: *id008
|
147
|
+
name: jeweler
|
151
148
|
prerelease: false
|
152
149
|
type: :development
|
153
|
-
|
154
|
-
|
150
|
+
- !ruby/object:Gem::Dependency
|
151
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
155
152
|
none: false
|
156
153
|
requirements:
|
157
154
|
- - ">="
|
@@ -160,12 +157,12 @@ dependencies:
|
|
160
157
|
segments:
|
161
158
|
- 0
|
162
159
|
version: "0"
|
163
|
-
|
164
|
-
|
160
|
+
version_requirements: *id009
|
161
|
+
name: rcov
|
165
162
|
prerelease: false
|
166
163
|
type: :development
|
167
|
-
|
168
|
-
|
164
|
+
- !ruby/object:Gem::Dependency
|
165
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
169
166
|
none: false
|
170
167
|
requirements:
|
171
168
|
- - "="
|
@@ -176,12 +173,12 @@ dependencies:
|
|
176
173
|
- 7
|
177
174
|
- 0
|
178
175
|
version: 1.7.0
|
179
|
-
|
180
|
-
|
176
|
+
version_requirements: *id010
|
177
|
+
name: vcr
|
181
178
|
prerelease: false
|
182
179
|
type: :development
|
183
|
-
|
184
|
-
|
180
|
+
- !ruby/object:Gem::Dependency
|
181
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
185
182
|
none: false
|
186
183
|
requirements:
|
187
184
|
- - "="
|
@@ -192,12 +189,12 @@ dependencies:
|
|
192
189
|
- 3
|
193
190
|
- 0
|
194
191
|
version: 1.3.0
|
195
|
-
|
196
|
-
|
192
|
+
version_requirements: *id011
|
193
|
+
name: fakeweb
|
197
194
|
prerelease: false
|
198
195
|
type: :development
|
199
|
-
|
200
|
-
|
196
|
+
- !ruby/object:Gem::Dependency
|
197
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
201
198
|
none: false
|
202
199
|
requirements:
|
203
200
|
- - "="
|
@@ -208,12 +205,12 @@ dependencies:
|
|
208
205
|
- 3
|
209
206
|
- 5
|
210
207
|
version: 0.3.5
|
211
|
-
|
212
|
-
|
208
|
+
version_requirements: *id012
|
209
|
+
name: timecop
|
213
210
|
prerelease: false
|
214
211
|
type: :development
|
215
|
-
|
216
|
-
|
212
|
+
- !ruby/object:Gem::Dependency
|
213
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
217
214
|
none: false
|
218
215
|
requirements:
|
219
216
|
- - "="
|
@@ -224,12 +221,12 @@ dependencies:
|
|
224
221
|
- 3
|
225
222
|
- 3
|
226
223
|
version: 1.3.3
|
227
|
-
|
228
|
-
|
224
|
+
version_requirements: *id013
|
225
|
+
name: factory_girl
|
229
226
|
prerelease: false
|
230
227
|
type: :development
|
231
|
-
|
232
|
-
|
228
|
+
- !ruby/object:Gem::Dependency
|
229
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
233
230
|
none: false
|
234
231
|
requirements:
|
235
232
|
- - "="
|
@@ -240,12 +237,12 @@ dependencies:
|
|
240
237
|
- 10
|
241
238
|
- 4
|
242
239
|
version: 0.10.4
|
243
|
-
|
244
|
-
|
240
|
+
version_requirements: *id014
|
241
|
+
name: ruby-debug
|
245
242
|
prerelease: false
|
246
|
-
type: :
|
247
|
-
|
248
|
-
|
243
|
+
type: :development
|
244
|
+
- !ruby/object:Gem::Dependency
|
245
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
249
246
|
none: false
|
250
247
|
requirements:
|
251
248
|
- - ">="
|
@@ -254,12 +251,12 @@ dependencies:
|
|
254
251
|
segments:
|
255
252
|
- 0
|
256
253
|
version: "0"
|
257
|
-
|
258
|
-
|
254
|
+
version_requirements: *id015
|
255
|
+
name: httparty
|
259
256
|
prerelease: false
|
260
257
|
type: :runtime
|
261
|
-
|
262
|
-
|
258
|
+
- !ruby/object:Gem::Dependency
|
259
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
263
260
|
none: false
|
264
261
|
requirements:
|
265
262
|
- - ">="
|
@@ -268,12 +265,12 @@ dependencies:
|
|
268
265
|
segments:
|
269
266
|
- 0
|
270
267
|
version: "0"
|
271
|
-
|
272
|
-
|
268
|
+
version_requirements: *id016
|
269
|
+
name: activesupport
|
273
270
|
prerelease: false
|
274
271
|
type: :runtime
|
275
|
-
|
276
|
-
|
272
|
+
- !ruby/object:Gem::Dependency
|
273
|
+
requirement: &id017 !ruby/object:Gem::Requirement
|
277
274
|
none: false
|
278
275
|
requirements:
|
279
276
|
- - "="
|
@@ -284,7 +281,10 @@ dependencies:
|
|
284
281
|
- 4
|
285
282
|
- 6
|
286
283
|
version: 1.4.6
|
287
|
-
|
284
|
+
version_requirements: *id017
|
285
|
+
name: json
|
286
|
+
prerelease: false
|
287
|
+
type: :runtime
|
288
288
|
description: Ooyala Backlot API Wrapper. Read more about the Ooyala Backlot API at http://www.ooyala.com/support/docs/backlot_api
|
289
289
|
email: anthony.navarre@factorylabs.com
|
290
290
|
executables: []
|
@@ -359,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
359
|
requirements: []
|
360
360
|
|
361
361
|
rubyforge_project:
|
362
|
-
rubygems_version: 1.
|
362
|
+
rubygems_version: 1.6.0
|
363
363
|
signing_key:
|
364
364
|
specification_version: 3
|
365
365
|
summary: Ooyala Backlot API Wrapper
|