youku_client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -0
- data/CHANGELOG.md +6 -0
- data/README.md +3 -1
- data/lib/youku/client.rb +7 -0
- data/lib/youku/v2/comments.rb +25 -0
- data/lib/youku/v2/request.rb +2 -0
- data/lib/youku/v2/searches.rb +0 -1
- data/lib/youku/v2/users.rb +16 -1
- data/lib/youku/version.rb +1 -1
- data/spec/youku/v2/comments_spec.rb +24 -0
- data/spec/youku/v2/users_spec.rb +18 -2
- data/spec/youku/v2/videos_spec.rb +3 -3
- data/youku_client.gemspec +1 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88241102eb4635e4dd5c689499ffe9059708ee56
|
4
|
+
data.tar.gz: c934e26daab56f7e827d18b15f72caf13915b429
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c0ba3dc6da07a1a17b3d26ddcfa6b01b571433ac4017584ce5dca2129da268d808b873d78844a75c84de644677ea55901a1c95e26b0f58ad8e02f7219bbcde8
|
7
|
+
data.tar.gz: ad4a0f89d148781291e40f387f9cef780ff7e26fd7928a963dbc5aa2be6144e5ff005ea2a48af6e0d3402fb97e94b4f24a281f8191b585b78539b7b695b6151a
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
0.0.2
|
2
|
+
------
|
3
|
+
* [Fixed generated urls not matching webmocks for `nil` parameters.](https://github.com/Shuttlerock/youku_client/pull/1) ([@BenjaminSchaaf](https://github.com/BenjaminSchaaf))
|
4
|
+
* [Added missing gems and requires](https://github.com/Shuttlerock/youku_client/pull/2) ([@BenjaminSchaaf](https://github.com/BenjaminSchaaf))
|
5
|
+
* [Implemented users.show](https://github.com/Shuttlerock/youku_client/pull/3) ([@BenjaminSchaaf](https://github.com/BenjaminSchaaf))
|
6
|
+
* [Implemented comments.by_video](https://github.com/Shuttlerock/youku_client/pull/4) ([@BenjaminSchaaf](https://github.com/BenjaminSchaaf))
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Youku Ruby Gem
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/Shuttlerock/youku_client.png)](http://travis-ci.org/Shuttlerock/youku_client) [![Code Climate](https://codeclimate.com/github/Shuttlerock/youku_client/badges/gpa.svg)](https://codeclimate.com/github/Shuttlerock/youku_client)
|
4
|
+
|
3
5
|
This is the unofficial Ruby wrapper for the Youku v2 API. It supports not all
|
4
6
|
endpoints currently available on the
|
5
7
|
[Youku API](http://open.youku.com/docs?id=0).
|
@@ -33,7 +35,7 @@ please if you would like to contribute, let me know and throw me a pull request!
|
|
33
35
|
|
34
36
|
### Requirements
|
35
37
|
|
36
|
-
* Ruby
|
38
|
+
* Ruby 2.x.x
|
37
39
|
|
38
40
|
---
|
39
41
|
|
data/lib/youku/client.rb
CHANGED
@@ -34,6 +34,12 @@ module Youku
|
|
34
34
|
Youku::V2::Users.new(self)
|
35
35
|
end
|
36
36
|
|
37
|
+
# Public: Get users API.
|
38
|
+
#
|
39
|
+
# Returns the instance of Youku::V2::Users.
|
40
|
+
def comments
|
41
|
+
Youku::V2::Comments.new(self)
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
39
45
|
|
@@ -41,3 +47,4 @@ require 'youku/v2/base'
|
|
41
47
|
require 'youku/v2/searches'
|
42
48
|
require 'youku/v2/users'
|
43
49
|
require 'youku/v2/videos'
|
50
|
+
require 'youku/v2/comments'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Youku
|
2
|
+
module V2
|
3
|
+
class Comments < Base
|
4
|
+
BASE_URI = "#{BASE_URI}/comments"
|
5
|
+
|
6
|
+
# Public: Get comments by a video ID
|
7
|
+
#
|
8
|
+
# See: http://open.youku.com/docs?id=35
|
9
|
+
#
|
10
|
+
# video_id - The string video ID.
|
11
|
+
# page - The Integer page number.
|
12
|
+
# count - The Integer page size.
|
13
|
+
#
|
14
|
+
# Returns the instance of Youku::V2::Request.
|
15
|
+
def by_video(video_id: nil, page: 1, count: 20)
|
16
|
+
Youku::V2::Request.new "#{BASE_URI}/by_video.json", {
|
17
|
+
client_id: client.client_id,
|
18
|
+
video_id: video_id,
|
19
|
+
page: page,
|
20
|
+
count: count,
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/youku/v2/request.rb
CHANGED
data/lib/youku/v2/searches.rb
CHANGED
data/lib/youku/v2/users.rb
CHANGED
@@ -15,10 +15,25 @@ module Youku
|
|
15
15
|
Youku::V2::Request.new "#{BASE_URI}/show_batch.json", {
|
16
16
|
client_id: client.client_id,
|
17
17
|
user_ids: user_ids,
|
18
|
-
user_names: user_names
|
18
|
+
user_names: user_names,
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
22
|
+
# Public: Get user by ID
|
23
|
+
#
|
24
|
+
# See: http://open.youku.com/docs?id=24
|
25
|
+
#
|
26
|
+
# user_id - The string of a youku user ID
|
27
|
+
# user_name - The string of a youku user name.
|
28
|
+
#
|
29
|
+
# Returns the instance of Youku::V2::Request.
|
30
|
+
def show(user_id: nil, user_name: nil)
|
31
|
+
Youku::V2::Request.new "#{BASE_URI}/show.json", {
|
32
|
+
client_id: client.client_id,
|
33
|
+
user_id: user_id,
|
34
|
+
user_name: user_name,
|
35
|
+
}
|
36
|
+
end
|
22
37
|
end
|
23
38
|
end
|
24
39
|
end
|
data/lib/youku/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Youku::V2::Comments do
|
4
|
+
|
5
|
+
let(:client) { Youku::Client.new(client_id: 'client-id') }
|
6
|
+
|
7
|
+
describe '#by_video' do
|
8
|
+
let(:url) { 'https://openapi.youku.com/v2/comments/by_video.json' }
|
9
|
+
let(:query) { {
|
10
|
+
client_id: client.client_id,
|
11
|
+
video_id: 123,
|
12
|
+
page: 1,
|
13
|
+
count: 20
|
14
|
+
} }
|
15
|
+
|
16
|
+
before do
|
17
|
+
stub_request(:get, url).with(query: query).to_return(status: 200)
|
18
|
+
end
|
19
|
+
|
20
|
+
subject { client.comments.by_video(video_id: 123) }
|
21
|
+
|
22
|
+
it_should_behave_like 'a base Youku API V2 requests'
|
23
|
+
end
|
24
|
+
end
|
data/spec/youku/v2/users_spec.rb
CHANGED
@@ -8,8 +8,8 @@ describe Youku::V2::Users do
|
|
8
8
|
describe '#show_batch' do
|
9
9
|
let(:url) { 'https://openapi.youku.com/v2/users/show_batch.json' }
|
10
10
|
let(:query) { {
|
11
|
-
client_id:
|
12
|
-
user_ids:
|
11
|
+
client_id: client.client_id,
|
12
|
+
user_ids: '',
|
13
13
|
user_names: 'jackie_chan',
|
14
14
|
} }
|
15
15
|
|
@@ -22,4 +22,20 @@ describe Youku::V2::Users do
|
|
22
22
|
it_should_behave_like 'a base Youku API V2 requests'
|
23
23
|
end
|
24
24
|
|
25
|
+
describe '#show' do
|
26
|
+
let(:url) { 'https://openapi.youku.com/v2/users/show.json' }
|
27
|
+
let(:query) { {
|
28
|
+
client_id: client.client_id,
|
29
|
+
user_id: '',
|
30
|
+
user_name: 'jackie_chan',
|
31
|
+
} }
|
32
|
+
|
33
|
+
before do
|
34
|
+
stub_request(:get, url).with(query: query).to_return(status: 200)
|
35
|
+
end
|
36
|
+
|
37
|
+
subject { users.show(user_name: 'jackie_chan') }
|
38
|
+
|
39
|
+
it_should_behave_like 'a base Youku API V2 requests'
|
40
|
+
end
|
25
41
|
end
|
@@ -10,7 +10,7 @@ describe Youku::V2::Videos do
|
|
10
10
|
let(:query) { {
|
11
11
|
client_id: client.client_id,
|
12
12
|
video_ids: 123,
|
13
|
-
ext:
|
13
|
+
ext: '',
|
14
14
|
} }
|
15
15
|
|
16
16
|
before do
|
@@ -27,7 +27,7 @@ describe Youku::V2::Videos do
|
|
27
27
|
let(:query) { {
|
28
28
|
client_id: client.client_id,
|
29
29
|
video_id: 123,
|
30
|
-
ext:
|
30
|
+
ext: '',
|
31
31
|
} }
|
32
32
|
|
33
33
|
before do
|
@@ -44,7 +44,7 @@ describe Youku::V2::Videos do
|
|
44
44
|
let(:query) { {
|
45
45
|
client_id: client.client_id,
|
46
46
|
user_id: 123,
|
47
|
-
user_name:
|
47
|
+
user_name: '',
|
48
48
|
orderby: 'published',
|
49
49
|
page: 1,
|
50
50
|
count: 20
|
data/youku_client.gemspec
CHANGED
@@ -4,6 +4,7 @@ require File.join(File.dirname(__FILE__), 'lib/youku/version')
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.add_dependency 'typhoeus'
|
6
6
|
gem.add_dependency 'hashie'
|
7
|
+
gem.add_dependency 'multi_json'
|
7
8
|
gem.add_development_dependency 'rake'
|
8
9
|
gem.add_development_dependency 'rspec'
|
9
10
|
gem.add_development_dependency 'webmock'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youku_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Vokhmin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: typhoeus
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: multi_json
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: rake
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,12 +106,15 @@ extensions: []
|
|
92
106
|
extra_rdoc_files: []
|
93
107
|
files:
|
94
108
|
- ".gitignore"
|
109
|
+
- ".travis.yml"
|
110
|
+
- CHANGELOG.md
|
95
111
|
- Gemfile
|
96
112
|
- LICENSE
|
97
113
|
- README.md
|
98
114
|
- Rakefile
|
99
115
|
- lib/youku/client.rb
|
100
116
|
- lib/youku/v2/base.rb
|
117
|
+
- lib/youku/v2/comments.rb
|
101
118
|
- lib/youku/v2/request.rb
|
102
119
|
- lib/youku/v2/searches.rb
|
103
120
|
- lib/youku/v2/users.rb
|
@@ -107,6 +124,7 @@ files:
|
|
107
124
|
- spec/spec_helper.rb
|
108
125
|
- spec/support/shared_examples/youku_api_v2_examples.rb
|
109
126
|
- spec/youku/client_spec.rb
|
127
|
+
- spec/youku/v2/comments_spec.rb
|
110
128
|
- spec/youku/v2/searches_spec.rb
|
111
129
|
- spec/youku/v2/users_spec.rb
|
112
130
|
- spec/youku/v2/videos_spec.rb
|
@@ -131,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
149
|
version: 1.3.6
|
132
150
|
requirements: []
|
133
151
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.4.
|
152
|
+
rubygems_version: 2.4.8
|
135
153
|
signing_key:
|
136
154
|
specification_version: 4
|
137
155
|
summary: Youku API wrapper
|
@@ -139,6 +157,7 @@ test_files:
|
|
139
157
|
- spec/spec_helper.rb
|
140
158
|
- spec/support/shared_examples/youku_api_v2_examples.rb
|
141
159
|
- spec/youku/client_spec.rb
|
160
|
+
- spec/youku/v2/comments_spec.rb
|
142
161
|
- spec/youku/v2/searches_spec.rb
|
143
162
|
- spec/youku/v2/users_spec.rb
|
144
163
|
- spec/youku/v2/videos_spec.rb
|