tangerine 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/.pairs CHANGED
@@ -0,0 +1,13 @@
1
+ pairs:
2
+ aw: Alex Welch; alexwelch
3
+ jz: Jay Zeschin; jayzes
4
+ ja: Josh Abbott; joshua.abbott
5
+ br: Brian Rose
6
+ gd: Grant Davis
7
+ an: Anthony Navarre; anthony.navarre
8
+ rr: Ryan Rabon; ryan.rabon
9
+ cw: Craig Williams; craig.williams
10
+ tl: Terrence Lee; terrence.lee
11
+ email:
12
+ prefix: pair
13
+ domain: factorylabs.com
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "httparty"
3
+ gem "httparty", "0.7.4"
4
+ gem "activesupport", "3.0.5"
4
5
 
5
6
  # Add dependencies to develop your gem here.
6
7
  # Include everything needed to run rake, tests, features, etc.
@@ -10,4 +11,8 @@ group :development do
10
11
  gem "bundler", "~> 1.0.0"
11
12
  gem "jeweler", "~> 1.5.2"
12
13
  gem "rcov", ">= 0"
14
+ gem "vcr", "1.7.0"
15
+ gem "fakeweb", "1.3.0"
16
+ gem "timecop", "0.3.5"
17
+ gem "ruby-debug", "0.10.4"
13
18
  end
data/Gemfile.lock CHANGED
@@ -1,8 +1,11 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ activesupport (3.0.5)
5
+ columnize (0.3.2)
4
6
  crack (0.1.8)
5
7
  diff-lcs (1.1.2)
8
+ fakeweb (1.3.0)
6
9
  git (1.2.5)
7
10
  httparty (0.7.4)
8
11
  crack (= 0.1.8)
@@ -10,6 +13,7 @@ GEM
10
13
  bundler (~> 1.0.0)
11
14
  git (>= 1.2.5)
12
15
  rake
16
+ linecache (0.43)
13
17
  rake (0.8.7)
14
18
  rcov (0.9.9)
15
19
  rspec (2.3.0)
@@ -20,15 +24,27 @@ GEM
20
24
  rspec-expectations (2.3.0)
21
25
  diff-lcs (~> 1.1.2)
22
26
  rspec-mocks (2.3.0)
27
+ ruby-debug (0.10.4)
28
+ columnize (>= 0.1)
29
+ ruby-debug-base (~> 0.10.4.0)
30
+ ruby-debug-base (0.10.4)
31
+ linecache (>= 0.3)
32
+ timecop (0.3.5)
33
+ vcr (1.7.0)
23
34
  yard (0.6.4)
24
35
 
25
36
  PLATFORMS
26
37
  ruby
27
38
 
28
39
  DEPENDENCIES
40
+ activesupport (= 3.0.5)
29
41
  bundler (~> 1.0.0)
30
- httparty
42
+ fakeweb (= 1.3.0)
43
+ httparty (= 0.7.4)
31
44
  jeweler (~> 1.5.2)
32
45
  rcov
33
46
  rspec (~> 2.3.0)
47
+ ruby-debug (= 0.10.4)
48
+ timecop (= 0.3.5)
49
+ vcr (= 1.7.0)
34
50
  yard (~> 0.6.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.1
@@ -0,0 +1,30 @@
1
+ class Tangerine::ChannelSet
2
+
3
+ attr_accessor :embed_code,
4
+ :title,
5
+ :description,
6
+ :status,
7
+ :uploaded_at,
8
+ :size,
9
+ :updated_at,
10
+ :flight_start_time,
11
+ :width,
12
+ :height,
13
+ :stat
14
+
15
+ def initialize(options)
16
+ options.delete('content_type')
17
+ options.each do |k,v|
18
+ # TODO: Look into using Crack gem for reliably undercoring these
19
+ attr = k.to_s.underscore
20
+ self.send("#{attr}=", v)
21
+ # TODO: move into Base class
22
+ end
23
+ end
24
+
25
+ def self.find(embed_code)
26
+ result = Tangerine::Query.new('contentType' => 'MultiChannel')
27
+ meh = result.response.parsed_response['list']['item'].first
28
+ Tangerine::ChannelSet.new(meh)
29
+ end
30
+ end
data/lib/tangerine.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'active_support/inflector'
1
2
  require 'tangerine/backlot'
3
+ require 'tangerine/backlot/channel_set'
2
4
  require 'tangerine/backlot/query'
3
5
  require 'tangerine/backlot/video'
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,20 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require 'rspec'
4
+ require 'timecop'
5
+ require 'vcr'
4
6
  require 'tangerine'
5
7
 
6
8
  # Requires supporting files with custom matchers and macros, etc,
7
9
  # in ./support/ and its subdirectories.
8
10
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
11
 
12
+ VCR.config do |c|
13
+ c.cassette_library_dir = 'spec/support/vcr_cassettes'
14
+ c.stub_with :fakeweb
15
+ end
16
+
10
17
  RSpec.configure do |config|
11
-
18
+ config.extend VCR::RSpec::Macros
12
19
  end
20
+
@@ -0,0 +1,13 @@
1
+ # This doesn't take into account things like lambdas, procs, or objects that might be unordered, it's mostly
2
+ # just for some convenience so we can check two basic objects without needing to check individual
3
+ # primitives piecemeal
4
+
5
+ RSpec::Matchers.define :be_functionally_equivalent_to do |expected|
6
+ match do |actual|
7
+ return false unless (actual.class == expected.class)
8
+ actual_values = actual.instance_variables.sort.map { |v| actual.instance_eval(v) }
9
+ expected_values = expected.instance_variables.sort.map { |v| expected.instance_eval(v) }
10
+ actual_values == expected_values
11
+ end
12
+ end
13
+
@@ -0,0 +1,107 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://api.ooyala.com:80/partner/query?pcode=lsNTrbQBqCQbH-VA6ALCshAHLWrV&expires=1325437210&signature=VAJNytKwToVNKastKoAoWArxXky58qE2B4CDGMQhJXY&contentType=MultiChannel
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ last-modified:
14
+ - Wed, 09 Mar 2011 22:17:59 GMT
15
+ content-type:
16
+ - application/xml; charset=utf-8
17
+ date:
18
+ - Wed, 09 Mar 2011 22:17:58 GMT
19
+ content-length:
20
+ - "2336"
21
+ set-cookie:
22
+ - ooyala-web-rails-session=BAh7CDoPdXBkYXRlZF9hdEl1OglUaW1lDTbJG4Bt76pHBjofQG1hcnNoYWxfd2l0aF91dGNfY29lcmNpb25UOg9zZXNzaW9uX2lkIiUzMzcyMTM4MjM4NTQyZTM0NTIxMTJmMjQ3NWU2YTZiOToSY3JlYXRpb25fdGltZUAG--ac51682d0ac32ee8a4f963e2dc7803e400ce56ad; path=/; HttpOnly
23
+ vary:
24
+ - Accept-Encoding,User-Agent
25
+ cache-control:
26
+ - private, max-age=0
27
+ body: |
28
+ <?xml version="1.0" encoding="UTF-8"?>
29
+ <list totalResults="5" size="5" pageID="0" statistics-as-of_text="Wed Mar 09 21:40:01 UTC 2011" limit="500" statistics-as-of="1299706801">
30
+ <item>
31
+ <embedCode><%= mock_channel_set.embed_code %></embedCode>
32
+ <title><%= mock_channel_set.title %></title>
33
+ <description></description>
34
+ <status>live</status>
35
+ <content_type>MultiChannel</content_type>
36
+ <uploadedAt>1294087113</uploadedAt>
37
+ <size></size>
38
+ <updatedAt>1294087113</updatedAt>
39
+ <flightStartTime>1294087113</flightStartTime>
40
+ <width>4</width>
41
+ <height>3</height>
42
+ <stat>
43
+ </stat>
44
+ </item>
45
+ <item>
46
+ <embedCode>x5b214MTomu6ISJSgohKKZbNuR9bdUJ8</embedCode>
47
+ <title>Pitchfork Live</title>
48
+ <description></description>
49
+ <status>live</status>
50
+ <content_type>MultiChannel</content_type>
51
+ <uploadedAt>1294087170</uploadedAt>
52
+ <size></size>
53
+ <updatedAt>1294087170</updatedAt>
54
+ <flightStartTime>1294087170</flightStartTime>
55
+ <width>4</width>
56
+ <height>3</height>
57
+ <stat>
58
+ </stat>
59
+ </item>
60
+ <item>
61
+ <embedCode>IwcG14MTrZJnBFuyM9s7XhY6QAe4qZdd</embedCode>
62
+ <title>Pitchfork Live</title>
63
+ <description></description>
64
+ <status>live</status>
65
+ <content_type>MultiChannel</content_type>
66
+ <uploadedAt>1294087178</uploadedAt>
67
+ <size></size>
68
+ <updatedAt>1294087179</updatedAt>
69
+ <flightStartTime>1294087178</flightStartTime>
70
+ <width>4</width>
71
+ <height>3</height>
72
+ <stat>
73
+ </stat>
74
+ </item>
75
+ <item>
76
+ <embedCode>YxcG14MToeDeUlMIpHGN7LGyFIQGh80-</embedCode>
77
+ <title>Pitchfork Live</title>
78
+ <description></description>
79
+ <status>live</status>
80
+ <content_type>MultiChannel</content_type>
81
+ <uploadedAt>1294087189</uploadedAt>
82
+ <size></size>
83
+ <updatedAt>1294087189</updatedAt>
84
+ <flightStartTime>1294087189</flightStartTime>
85
+ <width>4</width>
86
+ <height>3</height>
87
+ <stat>
88
+ </stat>
89
+ </item>
90
+ <item>
91
+ <embedCode>YycG14MTpdUGpQQifQQYXyMVx4WwvOjy</embedCode>
92
+ <title>Pitchfork Live</title>
93
+ <description></description>
94
+ <status>live</status>
95
+ <content_type>MultiChannel</content_type>
96
+ <uploadedAt>1294087199</uploadedAt>
97
+ <size></size>
98
+ <updatedAt>1294087200</updatedAt>
99
+ <flightStartTime>1294087199</flightStartTime>
100
+ <width>4</width>
101
+ <height>3</height>
102
+ <stat>
103
+ </stat>
104
+ </item>
105
+ </list>
106
+
107
+ http_version: "1.1"