redvine 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -36,9 +36,10 @@ It pretty much goes without saying that this wasn't authorized by Vine or anyone
36
36
  client.popular
37
37
  client.promoted
38
38
 
39
- ### Things To Do
39
+ ## Things To Do
40
40
 
41
41
  * Learn more about the API responses and objects
42
+ * Response pagination
42
43
  * Make it easier to access attributes of common objects (videos and users)
43
44
  * Include all of the discovered API endpoints
44
45
 
@@ -1,4 +1,5 @@
1
1
  require 'httparty'
2
+ require 'hashie'
2
3
  require 'redvine/version'
3
4
 
4
5
  class Redvine
@@ -60,7 +61,7 @@ class Redvine
60
61
 
61
62
  def get_request_data(endpoint, records=true)
62
63
  response = HTTParty.get(@@baseUrl + endpoint, {headers: session_headers})
63
- records ? response.parsed_response['data']['records'] : response.parsed_response['data']
64
+ records ? Hashie::Mash.new(response.parsed_response).data.records : Hashie::Mash.new(response.parsed_response).data
64
65
  end
65
66
 
66
67
  end
@@ -1,3 +1,3 @@
1
1
  class Redvine
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency 'httparty'
21
+ gem.add_dependency 'hashie'
21
22
 
22
23
  gem.add_development_dependency 'rake'
23
24
  gem.add_development_dependency 'rspec'
@@ -44,13 +44,13 @@ describe Redvine do
44
44
  end
45
45
  end
46
46
 
47
- it 'should return a result when searching for a common keyword' do
47
+ it 'should return a result set with videoUrls when searching for a common keyword' do
48
48
  VCR.use_cassette('redvine', :record => :new_episodes) do
49
49
  client = setup_client()
50
50
  vines = client.search('cat')
51
51
  expect(vines.count).to be > 1
52
- expect(vines.first.has_key?('videoUrl')).to be_true
53
- expect(vines.first.has_key?('avatarUrl')).to be_true
52
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
53
+ expect(vines.last.videoUrl).to be_an_instance_of(String)
54
54
  end
55
55
  end
56
56
 
@@ -67,7 +67,7 @@ describe Redvine do
67
67
  client = setup_client()
68
68
  vines = client.popular
69
69
  expect(vines.count).to be > 1
70
- expect(vines.first.has_key?('videoUrl')).to be_true
70
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
71
71
  end
72
72
  end
73
73
 
@@ -85,7 +85,7 @@ describe Redvine do
85
85
  client = setup_client()
86
86
  vines = client.promoted
87
87
  expect(vines.count).to be > 1
88
- expect(vines.first.has_key?('videoUrl')).to be_true
88
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
89
89
  end
90
90
  end
91
91
 
@@ -102,7 +102,7 @@ describe Redvine do
102
102
  client = setup_client()
103
103
  vines = client.timeline
104
104
  expect(vines.count).to be > 1
105
- expect(vines.first.has_key?('videoUrl')).to be_true
105
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
106
106
  end
107
107
  end
108
108
 
@@ -123,9 +123,9 @@ describe Redvine do
123
123
  VCR.use_cassette('redvine', :record => :new_episodes) do
124
124
  client = setup_client()
125
125
  profile = client.user_profile(client.user_id.to_s)
126
- expect(profile.has_key?('userId')).to be_true
127
- expect(profile.has_key?('username')).to be_true
128
- expect(profile.has_key?('avatarUrl')).to be_true
126
+ expect(profile.userId).not_to be_nil
127
+ expect(profile.username).to be_an_instance_of(String)
128
+ expect(profile.avatarUrl).to be_an_instance_of(String)
129
129
  end
130
130
  end
131
131
 
@@ -133,9 +133,9 @@ describe Redvine do
133
133
  VCR.use_cassette('redvine', :record => :new_episodes) do
134
134
  client = setup_client()
135
135
  profile = client.user_profile('914021455983943680')
136
- expect(profile.has_key?('userId')).to be_true
137
- expect(profile.has_key?('username')).to be_true
138
- expect(profile.has_key?('avatarUrl')).to be_true
136
+ expect(profile.userId).not_to be_nil
137
+ expect(profile.username).to be_an_instance_of(String)
138
+ expect(profile.avatarUrl).to be_an_instance_of(String)
139
139
  end
140
140
  end
141
141
 
@@ -157,13 +157,10 @@ describe Redvine do
157
157
  client = setup_client()
158
158
  vines = client.user_timeline('914021455983943680')
159
159
  expect(vines.count).to be > 1
160
- expect(vines.first.has_key?('videoUrl')).to be_true
160
+ expect(vines.first.videoUrl).to be_an_instance_of(String)
161
161
  end
162
162
  end
163
163
 
164
164
  end
165
165
 
166
-
167
-
168
-
169
166
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redvine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-29 00:00:00.000000000 Z
12
+ date: 2013-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: hashie
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rake
32
48
  requirement: !ruby/object:Gem::Requirement