tangerine 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  gem "httparty", "0.7.4"
4
4
  gem "activesupport", "3.0.5"
5
+ gem "json", "1.5.1"
5
6
  gem "i18n", "0.5.0"
6
7
 
7
8
  # Add dependencies to develop your gem here.
data/Gemfile.lock CHANGED
@@ -15,6 +15,7 @@ GEM
15
15
  bundler (~> 1.0.0)
16
16
  git (>= 1.2.5)
17
17
  rake
18
+ json (1.5.1)
18
19
  linecache (0.43)
19
20
  rake (0.8.7)
20
21
  rcov (0.9.9)
@@ -46,6 +47,7 @@ DEPENDENCIES
46
47
  httparty (= 0.7.4)
47
48
  i18n (= 0.5.0)
48
49
  jeweler (~> 1.5.2)
50
+ json (= 1.5.1)
49
51
  rcov
50
52
  rspec (~> 2.3.0)
51
53
  ruby-debug (= 0.10.4)
data/Rakefile CHANGED
@@ -21,6 +21,8 @@ Jeweler::Tasks.new do |gem|
21
21
 
22
22
  # Dependencies
23
23
  gem.add_dependency 'httparty'
24
+ gem.add_dependency 'activesupport'
25
+ gem.add_dependency 'json'
24
26
  end
25
27
  Jeweler::RubygemsDotOrgTasks.new
26
28
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
data/lib/tangerine.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  require 'active_support/inflector'
2
3
  require 'tangerine/backlot'
3
4
  require 'tangerine/backlot/base'
@@ -5,7 +5,9 @@ class Tangerine::Base
5
5
  options.each do |k,v|
6
6
  # TODO: Look into using Crack gem for reliably undercoring these
7
7
  attr = k.to_s.underscore
8
- self.send("#{attr}=", v)
8
+ method = "#{attr}="
9
+
10
+ self.send(method, v) if self.class.instance_methods(false).include?(method)
9
11
  end
10
12
  end
11
13
 
@@ -10,6 +10,10 @@ class Tangerine::Channel < Tangerine::Base
10
10
  :status,
11
11
  :uploaded_at
12
12
 
13
+ finder do
14
+ Tangerine.query('contentType' => 'Channel').parsed_response['list']['item']
15
+ end
16
+
13
17
  def videos
14
18
  channel = Tangerine::Backlot::API.get('/channels', 'mode' => 'list', 'channelEmbedCode' => embed_code)
15
19
  items = channel.parsed_response['channel']['item']
@@ -17,4 +21,20 @@ class Tangerine::Channel < Tangerine::Base
17
21
  embed_codes = items.collect { |item| item['embedCode'] }
18
22
  Tangerine::Video.where(:embed_code => embed_codes)
19
23
  end
24
+
25
+ def to_json(options = {})
26
+ # TODO: Figure out why rails needs this to be called so badly
27
+ vids = videos
28
+ {:size => size,
29
+ :title => title,
30
+ :thumbnail => thumbnail,
31
+ :updated_at => updated_at,
32
+ :embed_code => embed_code,
33
+ :description => description,
34
+ :length => length,
35
+ :status => status,
36
+ :uploaded_at => uploaded_at,
37
+ :videos => vids
38
+ }.to_json
39
+ end
20
40
  end
@@ -17,6 +17,10 @@ class Tangerine::ChannelSet < Tangerine::Base
17
17
  response.parsed_response['list']['item']
18
18
  end
19
19
 
20
+ def to_json(options = {})
21
+ {:channels => channels}.to_json
22
+ end
23
+
20
24
  def channels
21
25
  result = Tangerine::Backlot::API.get('/channel_sets', 'mode' => 'list', 'channelSetEmbedCode' => embed_code)
22
26
  items = result.parsed_response['channelSet']['channel']
@@ -17,10 +17,14 @@ class Tangerine::Video < Tangerine::Base
17
17
  :metadata,
18
18
  :stat
19
19
 
20
- def self.all
21
- Tangerine.query('contentType' => 'Video')
20
+ finder do
21
+ Tangerine.query('contentType' => 'Video').parsed_response['list']['item']
22
22
  end
23
23
 
24
+ # def self.all
25
+ # Tangerine.query('contentType' => 'Video')
26
+ # end
27
+
24
28
  def initialize(options={})
25
29
  @options = options
26
30
  add_metadata
@@ -44,6 +48,26 @@ class Tangerine::Video < Tangerine::Base
44
48
  items.collect { |item| Tangerine::Video.new(item) }
45
49
  end
46
50
 
51
+ def to_json(options = {})
52
+ {:size => size,
53
+ :title => title,
54
+ :thumbnail => thumbnail,
55
+ :content => content,
56
+ :updated_at => updated_at,
57
+ :embed_code => embed_code,
58
+ :description => description,
59
+ :length => length,
60
+ :status => status,
61
+ :uploaded_at => uploaded_at,
62
+ :flight_start_time => flight_start_time,
63
+ :width => width,
64
+ :height => height,
65
+ :labels => labels,
66
+ :metadata => metadata,
67
+ :stat => stat
68
+ }.to_json
69
+ end
70
+
47
71
  protected
48
72
 
49
73
  def add_labels
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.5.0"
8
+ s.version = "0.5.1"
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-03-15}
12
+ s.date = %q{2011-03-16}
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.5.0}
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",
@@ -77,6 +77,7 @@ Gem::Specification.new do |s|
77
77
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
78
78
  s.add_runtime_dependency(%q<httparty>, ["= 0.7.4"])
79
79
  s.add_runtime_dependency(%q<activesupport>, ["= 3.0.5"])
80
+ s.add_runtime_dependency(%q<json>, ["= 1.5.1"])
80
81
  s.add_runtime_dependency(%q<i18n>, ["= 0.5.0"])
81
82
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
82
83
  s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
@@ -89,9 +90,12 @@ Gem::Specification.new do |s|
89
90
  s.add_development_dependency(%q<factory_girl>, ["= 1.3.3"])
90
91
  s.add_development_dependency(%q<ruby-debug>, ["= 0.10.4"])
91
92
  s.add_runtime_dependency(%q<httparty>, [">= 0"])
93
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
94
+ s.add_runtime_dependency(%q<json>, [">= 0"])
92
95
  else
93
96
  s.add_dependency(%q<httparty>, ["= 0.7.4"])
94
97
  s.add_dependency(%q<activesupport>, ["= 3.0.5"])
98
+ s.add_dependency(%q<json>, ["= 1.5.1"])
95
99
  s.add_dependency(%q<i18n>, ["= 0.5.0"])
96
100
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
97
101
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
@@ -104,10 +108,13 @@ Gem::Specification.new do |s|
104
108
  s.add_dependency(%q<factory_girl>, ["= 1.3.3"])
105
109
  s.add_dependency(%q<ruby-debug>, ["= 0.10.4"])
106
110
  s.add_dependency(%q<httparty>, [">= 0"])
111
+ s.add_dependency(%q<activesupport>, [">= 0"])
112
+ s.add_dependency(%q<json>, [">= 0"])
107
113
  end
108
114
  else
109
115
  s.add_dependency(%q<httparty>, ["= 0.7.4"])
110
116
  s.add_dependency(%q<activesupport>, ["= 3.0.5"])
117
+ s.add_dependency(%q<json>, ["= 1.5.1"])
111
118
  s.add_dependency(%q<i18n>, ["= 0.5.0"])
112
119
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
113
120
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
@@ -120,6 +127,8 @@ Gem::Specification.new do |s|
120
127
  s.add_dependency(%q<factory_girl>, ["= 1.3.3"])
121
128
  s.add_dependency(%q<ruby-debug>, ["= 0.10.4"])
122
129
  s.add_dependency(%q<httparty>, [">= 0"])
130
+ s.add_dependency(%q<activesupport>, [">= 0"])
131
+ s.add_dependency(%q<json>, [">= 0"])
123
132
  end
124
133
  end
125
134
 
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Navarre
@@ -16,12 +16,11 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-03-15 00:00:00 -06:00
19
+ date: 2011-03-16 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: httparty
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - "="
@@ -32,12 +31,12 @@ dependencies:
32
31
  - 7
33
32
  - 4
34
33
  version: 0.7.4
34
+ version_requirements: *id001
35
+ name: httparty
35
36
  prerelease: false
36
37
  type: :runtime
37
- requirement: *id001
38
38
  - !ruby/object:Gem::Dependency
39
- name: activesupport
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
+ requirement: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
42
  - - "="
@@ -48,12 +47,28 @@ dependencies:
48
47
  - 0
49
48
  - 5
50
49
  version: 3.0.5
50
+ version_requirements: *id002
51
+ name: activesupport
51
52
  prerelease: false
52
53
  type: :runtime
53
- requirement: *id002
54
54
  - !ruby/object:Gem::Dependency
55
- name: i18n
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - "="
59
+ - !ruby/object:Gem::Version
60
+ hash: 1
61
+ segments:
62
+ - 1
63
+ - 5
64
+ - 1
65
+ version: 1.5.1
66
+ version_requirements: *id003
67
+ name: json
68
+ prerelease: false
69
+ type: :runtime
70
+ - !ruby/object:Gem::Dependency
71
+ requirement: &id004 !ruby/object:Gem::Requirement
57
72
  none: false
58
73
  requirements:
59
74
  - - "="
@@ -64,12 +79,12 @@ dependencies:
64
79
  - 5
65
80
  - 0
66
81
  version: 0.5.0
82
+ version_requirements: *id004
83
+ name: i18n
67
84
  prerelease: false
68
85
  type: :runtime
69
- requirement: *id003
70
86
  - !ruby/object:Gem::Dependency
71
- name: rspec
72
- version_requirements: &id004 !ruby/object:Gem::Requirement
87
+ requirement: &id005 !ruby/object:Gem::Requirement
73
88
  none: false
74
89
  requirements:
75
90
  - - ~>
@@ -80,12 +95,12 @@ dependencies:
80
95
  - 3
81
96
  - 0
82
97
  version: 2.3.0
98
+ version_requirements: *id005
99
+ name: rspec
83
100
  prerelease: false
84
101
  type: :development
85
- requirement: *id004
86
102
  - !ruby/object:Gem::Dependency
87
- name: yard
88
- version_requirements: &id005 !ruby/object:Gem::Requirement
103
+ requirement: &id006 !ruby/object:Gem::Requirement
89
104
  none: false
90
105
  requirements:
91
106
  - - ~>
@@ -96,12 +111,12 @@ dependencies:
96
111
  - 6
97
112
  - 0
98
113
  version: 0.6.0
114
+ version_requirements: *id006
115
+ name: yard
99
116
  prerelease: false
100
117
  type: :development
101
- requirement: *id005
102
118
  - !ruby/object:Gem::Dependency
103
- name: bundler
104
- version_requirements: &id006 !ruby/object:Gem::Requirement
119
+ requirement: &id007 !ruby/object:Gem::Requirement
105
120
  none: false
106
121
  requirements:
107
122
  - - ~>
@@ -112,12 +127,12 @@ dependencies:
112
127
  - 0
113
128
  - 0
114
129
  version: 1.0.0
130
+ version_requirements: *id007
131
+ name: bundler
115
132
  prerelease: false
116
133
  type: :development
117
- requirement: *id006
118
134
  - !ruby/object:Gem::Dependency
119
- name: jeweler
120
- version_requirements: &id007 !ruby/object:Gem::Requirement
135
+ requirement: &id008 !ruby/object:Gem::Requirement
121
136
  none: false
122
137
  requirements:
123
138
  - - ~>
@@ -128,12 +143,12 @@ dependencies:
128
143
  - 5
129
144
  - 2
130
145
  version: 1.5.2
146
+ version_requirements: *id008
147
+ name: jeweler
131
148
  prerelease: false
132
149
  type: :development
133
- requirement: *id007
134
150
  - !ruby/object:Gem::Dependency
135
- name: rcov
136
- version_requirements: &id008 !ruby/object:Gem::Requirement
151
+ requirement: &id009 !ruby/object:Gem::Requirement
137
152
  none: false
138
153
  requirements:
139
154
  - - ">="
@@ -142,12 +157,12 @@ dependencies:
142
157
  segments:
143
158
  - 0
144
159
  version: "0"
160
+ version_requirements: *id009
161
+ name: rcov
145
162
  prerelease: false
146
163
  type: :development
147
- requirement: *id008
148
164
  - !ruby/object:Gem::Dependency
149
- name: vcr
150
- version_requirements: &id009 !ruby/object:Gem::Requirement
165
+ requirement: &id010 !ruby/object:Gem::Requirement
151
166
  none: false
152
167
  requirements:
153
168
  - - "="
@@ -158,12 +173,12 @@ dependencies:
158
173
  - 7
159
174
  - 0
160
175
  version: 1.7.0
176
+ version_requirements: *id010
177
+ name: vcr
161
178
  prerelease: false
162
179
  type: :development
163
- requirement: *id009
164
180
  - !ruby/object:Gem::Dependency
165
- name: fakeweb
166
- version_requirements: &id010 !ruby/object:Gem::Requirement
181
+ requirement: &id011 !ruby/object:Gem::Requirement
167
182
  none: false
168
183
  requirements:
169
184
  - - "="
@@ -174,12 +189,12 @@ dependencies:
174
189
  - 3
175
190
  - 0
176
191
  version: 1.3.0
192
+ version_requirements: *id011
193
+ name: fakeweb
177
194
  prerelease: false
178
195
  type: :development
179
- requirement: *id010
180
196
  - !ruby/object:Gem::Dependency
181
- name: timecop
182
- version_requirements: &id011 !ruby/object:Gem::Requirement
197
+ requirement: &id012 !ruby/object:Gem::Requirement
183
198
  none: false
184
199
  requirements:
185
200
  - - "="
@@ -190,12 +205,12 @@ dependencies:
190
205
  - 3
191
206
  - 5
192
207
  version: 0.3.5
208
+ version_requirements: *id012
209
+ name: timecop
193
210
  prerelease: false
194
211
  type: :development
195
- requirement: *id011
196
212
  - !ruby/object:Gem::Dependency
197
- name: factory_girl
198
- version_requirements: &id012 !ruby/object:Gem::Requirement
213
+ requirement: &id013 !ruby/object:Gem::Requirement
199
214
  none: false
200
215
  requirements:
201
216
  - - "="
@@ -206,12 +221,12 @@ dependencies:
206
221
  - 3
207
222
  - 3
208
223
  version: 1.3.3
224
+ version_requirements: *id013
225
+ name: factory_girl
209
226
  prerelease: false
210
227
  type: :development
211
- requirement: *id012
212
228
  - !ruby/object:Gem::Dependency
213
- name: ruby-debug
214
- version_requirements: &id013 !ruby/object:Gem::Requirement
229
+ requirement: &id014 !ruby/object:Gem::Requirement
215
230
  none: false
216
231
  requirements:
217
232
  - - "="
@@ -222,12 +237,40 @@ dependencies:
222
237
  - 10
223
238
  - 4
224
239
  version: 0.10.4
240
+ version_requirements: *id014
241
+ name: ruby-debug
225
242
  prerelease: false
226
243
  type: :development
227
- requirement: *id013
228
244
  - !ruby/object:Gem::Dependency
245
+ requirement: &id015 !ruby/object:Gem::Requirement
246
+ none: false
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ hash: 3
251
+ segments:
252
+ - 0
253
+ version: "0"
254
+ version_requirements: *id015
229
255
  name: httparty
230
- version_requirements: &id014 !ruby/object:Gem::Requirement
256
+ prerelease: false
257
+ type: :runtime
258
+ - !ruby/object:Gem::Dependency
259
+ requirement: &id016 !ruby/object:Gem::Requirement
260
+ none: false
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ hash: 3
265
+ segments:
266
+ - 0
267
+ version: "0"
268
+ version_requirements: *id016
269
+ name: activesupport
270
+ prerelease: false
271
+ type: :runtime
272
+ - !ruby/object:Gem::Dependency
273
+ requirement: &id017 !ruby/object:Gem::Requirement
231
274
  none: false
232
275
  requirements:
233
276
  - - ">="
@@ -236,9 +279,10 @@ dependencies:
236
279
  segments:
237
280
  - 0
238
281
  version: "0"
282
+ version_requirements: *id017
283
+ name: json
239
284
  prerelease: false
240
285
  type: :runtime
241
- requirement: *id014
242
286
  description: Ooyala Backlot API Wrapper. Read more about the Ooyala Backlot API at http://www.ooyala.com/support/docs/backlot_api
243
287
  email: anthony.navarre@factorylabs.com
244
288
  executables: []
@@ -313,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
357
  requirements: []
314
358
 
315
359
  rubyforge_project:
316
- rubygems_version: 1.5.0
360
+ rubygems_version: 1.6.0
317
361
  signing_key:
318
362
  specification_version: 3
319
363
  summary: Ooyala Backlot API Wrapper