redvine 0.0.7 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7b6a33f99d78cd7c56d3f38106a674ebeb81c5a9
4
+ data.tar.gz: ccd30d81ae90c4833dedbdedd2e245d0a1fef7a1
5
+ SHA512:
6
+ metadata.gz: 845cba04456494faedfb305251fe1c8a1eae217ed5558f02668e9c7955a06454f9199e4a8d9021898f32d6ab507a376339f12a4ea0771159d88eea6c0bc1ba06
7
+ data.tar.gz: a9a121d3355572e013272497509a326d4f6669701db7ba794c10b623c9030d2ffa85b5d4df5b1d5cb2ea0b55dfe0743144fcded42dd2b48d81403bd6cbc64fa4
data/README.md CHANGED
@@ -6,6 +6,8 @@ Very heavily inspired by [Vino](https://github.com/tlack/vino), and made possibl
6
6
 
7
7
  It pretty much goes without saying that this wasn't authorized by Vine or anyone who works at Vine, so don't blame me if you try to use it and Vine gets mad at you.
8
8
 
9
+ Thanks also to [@kdonovan](https://github.com/kdonovan) and [@ruthgsp](https://github.com/ruthgsp) for adding and improving.
10
+
9
11
  ## Installation
10
12
 
11
13
  gem install redvine
@@ -34,16 +36,22 @@ It pretty much goes without saying that this wasn't authorized by Vine or anyone
34
36
  client.user_timeline('908082141764657152')
35
37
  client.user_timeline('908082141764657152', :page => 2)
36
38
 
39
+ # Get a user's followers/following by their user ID
40
+ client.followers('908082141764657152')
41
+ client.following('908082141764657152', :page => 2)
42
+
37
43
  # Get popular and promoted videos
38
44
  client.popular
39
45
  client.popular(:page => 2)
40
46
  client.promoted
41
47
  client.promoted(:page => 2)
48
+
49
+ # Get a single video by the post ID
50
+ client.single_post('1015405623653113856')
42
51
 
43
52
  ## Things To Do
44
53
 
45
- * Learn more about the API responses and objects
46
- * Response pagination
54
+ * Twitter authentication
47
55
  * Make it easier to access attributes of common objects (videos and users)
48
56
  * Include all of the discovered API endpoints
49
57
 
@@ -4,6 +4,21 @@ require 'redvine/version'
4
4
 
5
5
  class Redvine
6
6
 
7
+ class Error < StandardError; end
8
+ class ConnectionError < Redvine::Error
9
+ attr_reader :code
10
+
11
+ def initialize(code)
12
+ @code = code
13
+ end
14
+ end
15
+
16
+ class AuthenticationRequiredError < Redvine::Error
17
+ def initialize(msg="You must authenticate as a valid Vine user (call #connect) before accessing other API methods")
18
+ super(msg)
19
+ end
20
+ end
21
+
7
22
  attr_reader :vine_key, :username, :user_id
8
23
 
9
24
  @@baseUrl = 'https://api.vineapp.com/'
@@ -15,9 +30,14 @@ class Redvine
15
30
  query = {username: opts[:email], password: opts[:password], deviceToken: @@deviceToken}
16
31
  headers = {'User-Agent' => @@userAgent}
17
32
  response = HTTParty.post(@@baseUrl + 'users/authenticate', {body: query, headers: headers})
18
- @vine_key = response.parsed_response['data']['key']
19
- @username = response.parsed_response['data']['username']
20
- @user_id = response.parsed_response['data']['userId']
33
+
34
+ if opts[:skip_exception] || response['success']
35
+ @vine_key = response.parsed_response['data']['key']
36
+ @username = response.parsed_response['data']['username']
37
+ @user_id = response.parsed_response['data']['userId']
38
+ else
39
+ raise Redvine::ConnectionError.new(response['code'].to_i), response['error']
40
+ end
21
41
  end
22
42
 
23
43
  def search(tag, opts={})
@@ -37,6 +57,16 @@ class Redvine
37
57
  get_request_data('timelines/graph', opts)
38
58
  end
39
59
 
60
+ def following(uid,opts={})
61
+ raise(ArgumentError, 'You must specify a user id') if !uid
62
+ get_request_data("users/#{uid}/following", opts)
63
+ end
64
+
65
+ def followers(uid,opts={})
66
+ raise(ArgumentError, 'You must specify a user id') if !uid
67
+ get_request_data("users/#{uid}/followers", opts)
68
+ end
69
+
40
70
  def user_profile(uid)
41
71
  raise(ArgumentError, 'You must specify a user id') if !uid
42
72
  get_request_data('users/profiles/' + uid, {}, false)
@@ -71,11 +101,13 @@ class Redvine
71
101
  end
72
102
 
73
103
  def get_request_data(endpoint, query={}, records=true)
104
+ raise Redvine::AuthenticationRequiredError unless @vine_key
105
+
74
106
  query.merge!(:size => 20) if query.has_key?(:page) && !query.has_key?(:size)
75
107
  args = {:headers => session_headers}
76
108
  args.merge!(:query => query) if query != {}
77
109
  response = HTTParty.get(@@baseUrl + endpoint, args).parsed_response
78
- return Hashie::Mash.new(JSON.parse('{"success": false}')) if response.kind_of?(String)
110
+ return Hashie::Mash.new(JSON.parse('{"success": false}')) if response.kind_of?(String)
79
111
  if response['success'] == false
80
112
  response['error'] = true
81
113
  return Hashie::Mash.new(response)
@@ -1,3 +1,3 @@
1
1
  class Redvine
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1"
3
3
  end
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency 'httparty'
21
21
  gem.add_dependency 'hashie'
22
22
 
23
+ gem.add_development_dependency 'debugger'
23
24
  gem.add_development_dependency 'rake'
24
25
  gem.add_development_dependency 'rspec'
25
26
  gem.add_development_dependency 'webmock'
@@ -6,249 +6,342 @@ include Helpers
6
6
 
7
7
  describe Redvine do
8
8
 
9
- describe '.connect' do
9
+ it "should require connecting before accessing other API methods" do
10
+ config = get_config
11
+ client = Redvine.new
12
+ expect { client.search('cat') }.to raise_error(Redvine::AuthenticationRequiredError)
13
+ end
10
14
 
15
+ describe '.connect' do
16
+
17
+ let(:config) { get_config() }
18
+ let(:client) { Redvine.new }
19
+
11
20
  it 'should create a new client' do
12
- expect(Redvine.new).to respond_to(:connect).with(1).argument
21
+ expect(client).to respond_to(:connect).with(1).argument
13
22
  end
14
23
 
15
24
  it 'should raise an error without a username and password' do
16
- client = Redvine.new
17
25
  expect { client.connect() }.to raise_error(ArgumentError)
18
26
  end
19
27
 
20
28
  it 'should connect and return a hash with a :vine_key' do
21
29
  VCR.use_cassette('redvine') do
22
- config = get_config()
23
- client = Redvine.new
24
30
  client.connect(email: config['email'], password: config['password'])
25
31
  expect(client.vine_key).to be_an_instance_of(String)
26
32
  end
27
33
  end
28
34
 
29
- end
30
-
31
- describe '.search' do
32
-
33
- it 'should respond to a search method' do
34
- VCR.use_cassette('redvine') do
35
- client = setup_client()
36
- expect(client).to respond_to(:search)
35
+ it 'should raise a specific error if username/password is incorrect' do
36
+ VCR.use_cassette('redvine_error') do
37
+ expect { client.connect(email: 'fake_email@someplace.net', password: 'nope1nope2nope3') }.to raise_error(Redvine::ConnectionError)
37
38
  end
38
39
  end
39
40
 
40
- it 'should throw an error without a tag' do
41
- VCR.use_cassette('redvine') do
42
- client = setup_client()
43
- expect{ client.search() }.to raise_error(ArgumentError)
41
+ it 'should extract error code and message if username/password is incorrect' do
42
+ VCR.use_cassette('redvine_error') do
43
+ begin
44
+ client.connect(email: 'fake_email@someplace.net', password: 'nope1nope2nope3')
45
+ rescue Redvine::ConnectionError => e
46
+ expect(e.code).to be_an_instance_of(Fixnum)
47
+ expect(e.code).to be > 0
48
+ expect(e.message).to be_an_instance_of(String)
49
+ end
44
50
  end
45
51
  end
46
52
 
47
- it 'should return a result set with videoUrls when searching for a common keyword' do
48
- VCR.use_cassette('redvine', :record => :new_episodes) do
49
- client = setup_client()
50
- vines = client.search('cat')
51
- expect(vines.count).to be > 1
52
- expect(vines.first.videoUrl).to be_an_instance_of(String)
53
- expect(vines.last.videoUrl).to be_an_instance_of(String)
53
+ it 'should not raise if passed skip_exception when username/password is incorrect' do
54
+ VCR.use_cassette('redvine_error') do
55
+ expect { client.connect(email: 'fake_email@someplace.net', password: 'nope1nope2nope3', skip_exception: true) }.to_not raise_error
54
56
  end
55
57
  end
56
58
 
57
- it 'should return a second page of results' do
58
- VCR.use_cassette('redvine', :record => :new_episodes) do
59
- client = setup_client()
60
- vines = client.search('cat')
61
- vinesp2 = client.search('cat', :page => 2)
62
- expect(vines).to_not equal(vinesp2)
63
- expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
59
+ end
60
+
61
+ context '(when authenticated)' do
62
+
63
+ let(:client) { setup_client() }
64
+
65
+ describe '.search' do
66
+
67
+ it 'should respond to a search method' do
68
+ VCR.use_cassette('redvine') do
69
+ expect(client).to respond_to(:search)
70
+ end
64
71
  end
65
- end
66
72
 
67
- end
73
+ it 'should throw an error without a tag' do
74
+ VCR.use_cassette('redvine') do
75
+ expect{ client.search() }.to raise_error(ArgumentError)
76
+ end
77
+ end
68
78
 
69
- describe '.popular' do
79
+ it 'should return a result set with videoUrls when searching for a common keyword' do
80
+ VCR.use_cassette('redvine', :record => :new_episodes) do
81
+ vines = client.search('cat')
82
+ expect(vines.count).to be > 1
83
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
84
+ expect(vines.last.videoUrl).to be_an_instance_of(String)
85
+ end
86
+ end
87
+
88
+ it 'should return a second page of results' do
89
+ VCR.use_cassette('redvine', :record => :new_episodes) do
90
+ vines = client.search('cat')
91
+ vinesp2 = client.search('cat', :page => 2)
92
+ expect(vines).to_not equal(vinesp2)
93
+ expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
94
+ end
95
+ end
70
96
 
71
- it 'should respond to a popular method' do
72
- expect(Redvine.new).to respond_to(:popular)
73
97
  end
74
98
 
75
- it 'should return a set of results with VideoUrls' do
76
- VCR.use_cassette('redvine', :record => :new_episodes) do
77
- client = setup_client()
78
- vines = client.popular
79
- expect(vines.count).to be > 1
80
- expect(vines.first.videoUrl).to be_an_instance_of(String)
99
+ describe '.popular' do
100
+
101
+ it 'should respond to a popular method' do
102
+ expect(client).to respond_to(:popular)
103
+ end
104
+
105
+ it 'should return a set of results with VideoUrls' do
106
+ VCR.use_cassette('redvine', :record => :new_episodes) do
107
+ vines = client.popular
108
+ expect(vines.count).to be > 1
109
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
110
+ end
81
111
  end
82
- end
83
112
 
84
- it 'should return a second page of results' do
85
- VCR.use_cassette('redvine', :record => :new_episodes) do
86
- client = setup_client()
87
- vines = client.popular
88
- vinesp2 = client.popular(:page => 2)
89
- expect(vines).to_not equal(vinesp2)
90
- expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
113
+ it 'should return a second page of results' do
114
+ VCR.use_cassette('redvine', :record => :new_episodes) do
115
+ vines = client.popular
116
+ vinesp2 = client.popular(:page => 2)
117
+ expect(vines).to_not equal(vinesp2)
118
+ expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
119
+ end
91
120
  end
121
+
92
122
  end
93
123
 
94
- end
95
124
 
125
+ describe '.promoted' do
96
126
 
97
- describe '.promoted' do
127
+ it 'should respond to a promoted method' do
128
+ expect(client).to respond_to(:promoted)
129
+ end
98
130
 
99
- it 'should respond to a promoted method' do
100
- expect(Redvine.new).to respond_to(:promoted)
101
- end
131
+ it 'should return a set of results with VideoUrls' do
132
+ VCR.use_cassette('redvine', :record => :new_episodes) do
133
+ vines = client.promoted
134
+ expect(vines.count).to be > 1
135
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
136
+ end
137
+ end
102
138
 
103
- it 'should return a set of results with VideoUrls' do
104
- VCR.use_cassette('redvine', :record => :new_episodes) do
105
- client = setup_client()
106
- vines = client.promoted
107
- expect(vines.count).to be > 1
108
- expect(vines.first.videoUrl).to be_an_instance_of(String)
139
+ it 'should return a second page of results' do
140
+ VCR.use_cassette('redvine', :record => :new_episodes) do
141
+ vines = client.promoted
142
+ vinesp2 = client.promoted(:page => 2)
143
+ expect(vines).to_not equal(vinesp2)
144
+ expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
145
+ end
109
146
  end
147
+
110
148
  end
111
149
 
112
- it 'should return a second page of results' do
113
- VCR.use_cassette('redvine', :record => :new_episodes) do
114
- client = setup_client()
115
- vines = client.promoted
116
- vinesp2 = client.promoted(:page => 2)
117
- expect(vines).to_not equal(vinesp2)
118
- expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
150
+ describe '.timeline' do
151
+
152
+ it 'should respond to a timeline method' do
153
+ expect(client).to respond_to(:timeline)
119
154
  end
120
- end
121
155
 
122
- end
156
+ it 'should return a set of results with VideoUrls' do
157
+ VCR.use_cassette('redvine', :record => :new_episodes) do
158
+ vines = client.timeline
159
+ expect(vines.count).to be > 1
160
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
161
+ end
162
+ end
123
163
 
124
- describe '.timeline' do
164
+ it 'should return a second page of results' do
165
+ VCR.use_cassette('redvine', :record => :new_episodes) do
166
+ vines = client.timeline()
167
+ vinesp2 = client.timeline(:page => 2)
168
+ expect(vines).to_not equal(vinesp2)
169
+ expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
170
+ end
171
+ end
125
172
 
126
- it 'should respond to a timeline method' do
127
- expect(Redvine.new).to respond_to(:timeline)
128
173
  end
129
174
 
130
- it 'should return a set of results with VideoUrls' do
131
- VCR.use_cassette('redvine', :record => :new_episodes) do
132
- client = setup_client()
133
- vines = client.timeline
134
- expect(vines.count).to be > 1
135
- expect(vines.first.videoUrl).to be_an_instance_of(String)
175
+ describe '.user_profile' do
176
+
177
+ it 'should respond to a user_profile method' do
178
+ expect(client).to respond_to(:user_profile)
136
179
  end
137
- end
138
180
 
139
- it 'should return a second page of results' do
140
- VCR.use_cassette('redvine', :record => :new_episodes) do
141
- client = setup_client()
142
- vines = client.timeline()
143
- vinesp2 = client.timeline(:page => 2)
144
- expect(vines).to_not equal(vinesp2)
145
- expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
181
+ it 'should throw an error without a user id' do
182
+ expect { client.user_profile() }.to raise_error(ArgumentError)
146
183
  end
147
- end
148
184
 
149
- end
185
+ it 'should return a user profile for the authenticated user' do
186
+ VCR.use_cassette('redvine', :record => :new_episodes) do
187
+ profile = client.user_profile(client.user_id.to_s)
188
+ expect(profile.userId).not_to be_nil
189
+ expect(profile.username).to be_an_instance_of(String)
190
+ expect(profile.avatarUrl).to be_an_instance_of(String)
191
+ end
192
+ end
150
193
 
151
- describe '.user_profile' do
194
+ it 'should return a user profile given a valid user id' do
195
+ VCR.use_cassette('redvine', :record => :new_episodes) do
196
+ profile = client.user_profile('914021455983943680')
197
+ expect(profile.userId).not_to be_nil
198
+ expect(profile.username).to be_an_instance_of(String)
199
+ expect(profile.avatarUrl).to be_an_instance_of(String)
200
+ end
201
+ end
152
202
 
153
- it 'should respond to a user_profile method' do
154
- expect(Redvine.new).to respond_to(:user_profile)
155
203
  end
156
204
 
157
- it 'should throw an error without a user id' do
158
- client = Redvine.new
159
- expect { client.user_profile() }.to raise_error(ArgumentError)
160
- end
205
+ describe '.user_timeline' do
161
206
 
162
- it 'should return a user profile for the authenticated user' do
163
- VCR.use_cassette('redvine', :record => :new_episodes) do
164
- client = setup_client()
165
- profile = client.user_profile(client.user_id.to_s)
166
- expect(profile.userId).not_to be_nil
167
- expect(profile.username).to be_an_instance_of(String)
168
- expect(profile.avatarUrl).to be_an_instance_of(String)
207
+ it 'should respond to a user_timeline method' do
208
+ expect(client).to respond_to(:user_timeline)
169
209
  end
170
- end
171
210
 
172
- it 'should return a user profile given a valid user id' do
173
- VCR.use_cassette('redvine', :record => :new_episodes) do
174
- client = setup_client()
175
- profile = client.user_profile('914021455983943680')
176
- expect(profile.userId).not_to be_nil
177
- expect(profile.username).to be_an_instance_of(String)
178
- expect(profile.avatarUrl).to be_an_instance_of(String)
211
+ it 'should throw an error without a user id' do
212
+ expect { client.user_timeline() }.to raise_error(ArgumentError)
179
213
  end
180
- end
181
214
 
182
- end
215
+ it 'should return a set of results with VideoUrls given a valid user id' do
216
+ VCR.use_cassette('redvine', :record => :new_episodes) do
217
+ vines = client.user_timeline('914021455983943680')
218
+ expect(vines.count).to be > 1
219
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
220
+ end
221
+ end
183
222
 
184
- describe '.user_timeline' do
223
+ it 'should return a second page of results' do
224
+ VCR.use_cassette('redvine', :record => :new_episodes) do
225
+ vines = client.user_timeline('914021455983943680')
226
+ vinesp2 = client.user_timeline('914021455983943680', :page => 2)
227
+ expect(vines).to_not equal(vinesp2)
228
+ expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
229
+ end
230
+ end
185
231
 
186
- it 'should respond to a user_timeline method' do
187
- expect(Redvine.new).to respond_to(:user_timeline)
188
- end
232
+ it 'should not break if an error is returned from Vine' do
233
+ VCR.use_cassette('redvine', :record => :new_episodes) do
234
+ vines = client.user_timeline('965095451261071400')
235
+ expect(vines.success).to be_false
236
+ vines = client.user_timeline('XXX')
237
+ expect(vines.success).to be_false
238
+ end
239
+ end
189
240
 
190
- it 'should throw an error without a user id' do
191
- client = Redvine.new
192
- expect { client.user_timeline() }.to raise_error(ArgumentError)
193
241
  end
194
242
 
195
- it 'should return a set of results with VideoUrls given a valid user id' do
196
- VCR.use_cassette('redvine', :record => :new_episodes) do
197
- client = setup_client()
198
- vines = client.user_timeline('914021455983943680')
199
- expect(vines.count).to be > 1
200
- expect(vines.first.videoUrl).to be_an_instance_of(String)
243
+ describe '.following' do
244
+
245
+ it 'should respond to a following method' do
246
+ expect(client).to respond_to(:following)
201
247
  end
202
- end
203
-
204
- it 'should return a second page of results' do
205
- VCR.use_cassette('redvine', :record => :new_episodes) do
206
- client = setup_client()
207
- vines = client.user_timeline('914021455983943680')
208
- vinesp2 = client.user_timeline('914021455983943680', :page => 2)
209
- expect(vines).to_not equal(vinesp2)
210
- expect(vines.first.videoUrl).to_not equal(vinesp2.first.videoUrl)
248
+
249
+ it 'should throw an error without a user id' do
250
+ expect { client.following() }.to raise_error(ArgumentError)
251
+ end
252
+
253
+ it 'should return a set of results with avatar and username given a valid user id' do
254
+ VCR.use_cassette('redvine', :record => :new_episodes) do
255
+ users = client.following('914021455983943680')
256
+ expect(users.count).to be > 1
257
+ expect(users.first.username).to be_an_instance_of(String)
258
+ expect(users.first.avatarUrl).to be_an_instance_of(String)
259
+ end
260
+ end
261
+
262
+ it 'should return a second page of results' do
263
+ VCR.use_cassette('redvine', :record => :new_episodes) do
264
+ users = client.following('914021455983943680')
265
+ usersp2 = client.following('914021455983943680', :page => 2)
266
+ expect(users).to_not equal(usersp2)
267
+ expect(users.first.avatarUrl).to_not equal(usersp2.first.avatarUrl)
268
+ end
269
+ end
270
+
271
+ it 'should not break if an error is returned from Vine' do
272
+ VCR.use_cassette('redvine', :record => :new_episodes) do
273
+ users = client.following('965095451261071400')
274
+ expect(users.success).to be_false
275
+ users = client.following('XXX')
276
+ expect(users.success).to be_false
277
+ end
211
278
  end
279
+
212
280
  end
213
281
 
214
- it 'should not break if an error is returned from Vine' do
215
- VCR.use_cassette('redvine', :record => :new_episodes) do
216
- client = setup_client()
217
- vines = client.user_timeline('965095451261071400')
218
- expect(vines.success).to be_false
219
- vines = client.user_timeline('XXX')
220
- expect(vines.success).to be_false
282
+ describe '.followers' do
283
+
284
+ it 'should respond to a followers method' do
285
+ expect(client).to respond_to(:followers)
286
+ end
287
+
288
+ it 'should throw an error without a user id' do
289
+ expect { client.followers() }.to raise_error(ArgumentError)
290
+ end
291
+
292
+ it 'should return a set of results with avatar and username given a valid user id' do
293
+ VCR.use_cassette('redvine', :record => :new_episodes) do
294
+ users = client.followers('914021455983943680')
295
+ expect(users.count).to be > 1
296
+ expect(users.first.username).to be_an_instance_of(String)
297
+ expect(users.first.avatarUrl).to be_an_instance_of(String)
298
+ end
299
+ end
300
+
301
+ it 'should return a second page of results' do
302
+ VCR.use_cassette('redvine', :record => :new_episodes) do
303
+ users = client.followers('914021455983943680')
304
+ usersp2 = client.followers('914021455983943680', :page => 2)
305
+ expect(users).to_not equal(usersp2)
306
+ expect(users.first.avatarUrl).to_not equal(usersp2.first.avatarUrl)
307
+ end
308
+ end
309
+
310
+ it 'should not break if an error is returned from Vine' do
311
+ VCR.use_cassette('redvine', :record => :new_episodes) do
312
+ users = client.followers('965095451261071400')
313
+ expect(users.success).to be_false
314
+ users = client.followers('XXX')
315
+ expect(users.success).to be_false
316
+ end
221
317
  end
318
+
222
319
  end
223
320
 
224
- end
225
-
226
- describe '.single_post' do
321
+ describe '.single_post' do
227
322
 
228
- it 'should respond to a single_post method' do
229
- expect(Redvine.new).to respond_to(:single_post)
230
- end
323
+ it 'should respond to a single_post method' do
324
+ expect(client).to respond_to(:single_post)
325
+ end
231
326
 
232
- it 'should require a post id as an argument' do
233
- client = Redvine.new
234
- expect { client.single_post() }.to raise_error(ArgumentError)
235
- end
327
+ it 'should require a post id as an argument' do
328
+ expect { client.single_post() }.to raise_error(ArgumentError)
329
+ end
236
330
 
237
- it 'should return a single media result with a valid post id' do
238
- VCR.use_cassette('redvine', :record => :new_episodes) do
239
- client = setup_client()
240
- vine = client.single_post('1015405623653113856')
241
- expect(vine.videoUrl).to be_an_instance_of(String)
331
+ it 'should return a single media result with a valid post id' do
332
+ VCR.use_cassette('redvine', :record => :new_episodes) do
333
+ vine = client.single_post('1038918228849876992')
334
+ expect(vine.videoUrl).to be_an_instance_of(String)
335
+ end
242
336
  end
243
- end
244
337
 
245
- it 'should not break if no post exists with that id' do
246
- VCR.use_cassette('redvine', :record => :new_episodes) do
247
- client = setup_client()
248
- vine = client.single_post('397923400300')
249
- expect(vine.success).to be_false
250
- vine2 = client.single_post('XXX')
251
- expect(vine2.success).to be_false
338
+ it 'should not break if no post exists with that id' do
339
+ VCR.use_cassette('redvine', :record => :new_episodes) do
340
+ vine = client.single_post('397923400300')
341
+ expect(vine.success).to be_false
342
+ vine2 = client.single_post('XXX')
343
+ expect(vine2.success).to be_false
344
+ end
252
345
  end
253
346
  end
254
347
 
@@ -1,8 +1,12 @@
1
+ require 'debugger'
2
+
1
3
  module Helpers
2
4
  def setup_client
3
5
  config = get_config()
4
6
  client = Redvine.new
5
- client.connect(email: config['email'], password: config['password'])
7
+ VCR.use_cassette('redvine_auth') do
8
+ client.connect(email: config['email'], password: config['password'])
9
+ end
6
10
  client
7
11
  end
8
12
 
metadata CHANGED
@@ -1,126 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redvine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: '0.1'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jay Stakelon
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-22 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: hashie
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: debugger
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
44
53
  - !ruby/object:Gem::Version
45
54
  version: '0'
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: rake
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
- - - ! '>='
59
+ - - '>='
52
60
  - !ruby/object:Gem::Version
53
61
  version: '0'
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
- - - ! '>='
66
+ - - '>='
60
67
  - !ruby/object:Gem::Version
61
68
  version: '0'
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: rspec
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
- - - ! '>='
73
+ - - '>='
68
74
  - !ruby/object:Gem::Version
69
75
  version: '0'
70
76
  type: :development
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
- - - ! '>='
80
+ - - '>='
76
81
  - !ruby/object:Gem::Version
77
82
  version: '0'
78
83
  - !ruby/object:Gem::Dependency
79
84
  name: webmock
80
85
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
86
  requirements:
83
- - - ! '>='
87
+ - - '>='
84
88
  - !ruby/object:Gem::Version
85
89
  version: '0'
86
90
  type: :development
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
93
  requirements:
91
- - - ! '>='
94
+ - - '>='
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
97
  - !ruby/object:Gem::Dependency
95
98
  name: vcr
96
99
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
100
  requirements:
99
- - - ! '>='
101
+ - - '>='
100
102
  - !ruby/object:Gem::Version
101
103
  version: '0'
102
104
  type: :development
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
107
  requirements:
107
- - - ! '>='
108
+ - - '>='
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  - !ruby/object:Gem::Dependency
111
112
  name: autotest-standalone
112
113
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
121
  requirements:
123
- - - ! '>='
122
+ - - '>='
124
123
  - !ruby/object:Gem::Version
125
124
  version: '0'
126
125
  description: A client for the unofficial Vine API.
@@ -144,27 +143,26 @@ files:
144
143
  - spec/vcr_setup.rb
145
144
  homepage: http://github.com/stakes/redvine
146
145
  licenses: []
146
+ metadata: {}
147
147
  post_install_message:
148
148
  rdoc_options: []
149
149
  require_paths:
150
150
  - lib
151
151
  required_ruby_version: !ruby/object:Gem::Requirement
152
- none: false
153
152
  requirements:
154
- - - ! '>='
153
+ - - '>='
155
154
  - !ruby/object:Gem::Version
156
155
  version: '0'
157
156
  required_rubygems_version: !ruby/object:Gem::Requirement
158
- none: false
159
157
  requirements:
160
- - - ! '>='
158
+ - - '>='
161
159
  - !ruby/object:Gem::Version
162
160
  version: '0'
163
161
  requirements: []
164
162
  rubyforge_project:
165
- rubygems_version: 1.8.24
163
+ rubygems_version: 2.0.3
166
164
  signing_key:
167
- specification_version: 3
165
+ specification_version: 4
168
166
  summary: A client for the unofficial Vine API.
169
167
  test_files:
170
168
  - spec/redvine_spec.rb