yourub 2.0.0 → 2.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 +19 -0
- data/README.md +29 -13
- data/lib/yourub/config.rb +0 -1
- data/lib/yourub/default.rb +0 -4
- data/lib/yourub/rest/request.rb +4 -5
- data/lib/yourub/version.rb +1 -1
- metadata +3 -3
- data/yourub.sublime-project +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64d97865517be78962f3b8e9222f3c5d0db480ff
|
4
|
+
data.tar.gz: eca3604b94f9893d6c0334d8c149cf27d82a7355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6180c0872f7939e9286642079f8fc93a60fef7adb49ab0cef5e2380db5245652fee3a2ce85a662ae7c83664ecf433fcf583502dbfeb2869941a810327c20ed1
|
7
|
+
data.tar.gz: 3366a1e4ed5d8b78a099fbdef5da5b38f2a9f8e4e7cb21cf51f3aadd829daf09b79d38bbf3b296fa38ce86ee17d55ad6492c2387c82a882a7abcaf31d83e6b0d
|
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 1.9.3
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1
|
7
|
+
- 2.2
|
8
|
+
- jruby-19mode
|
9
|
+
- jruby-head
|
10
|
+
- rbx-2
|
11
|
+
- ruby-head
|
12
|
+
|
13
|
+
sudo: false
|
14
|
+
|
15
|
+
bundler_args: --without development --retry=3 --jobs=3
|
16
|
+
|
17
|
+
env:
|
18
|
+
global:
|
19
|
+
- JRUBY_OPTS="$JRUBY_OPTS --debug"
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/yourub.svg)](http://badge.fury.io/rb/yourub)
|
2
|
+
[![Dependency Status](https://gemnasium.com/edap/yourub.svg)](https://gemnasium.com/edap/yourub)
|
3
|
+
[![Build Status](https://travis-ci.org/edap/yourub.svg?branch=master)](https://travis-ci.org/edap/yourub)
|
1
4
|
[![Code Climate](https://codeclimate.com/github/edap/yourub.png)](https://codeclimate.com/github/edap/yourub)
|
2
5
|
|
3
6
|
# Yourub
|
@@ -42,7 +45,7 @@ test:
|
|
42
45
|
```
|
43
46
|
|
44
47
|
If you want to use it from the console, or in another program, you can simply
|
45
|
-
pass an hash containing the needed
|
48
|
+
pass an hash containing the needed options
|
46
49
|
```ruby
|
47
50
|
options = { developer_key: 'mySecretKey',
|
48
51
|
application_name: 'yourub',
|
@@ -78,8 +81,6 @@ that is the content of the response:
|
|
78
81
|
### Available parameters
|
79
82
|
`:query` String, example `aliens`
|
80
83
|
|
81
|
-
`:id` Sting, a valid youtube video id, example `NisCkxU544c`. If this parameter is set, tha others are ignored
|
82
|
-
|
83
84
|
`:country` String, one or more alpha-2 country codes [ISO 3166-1](http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm), example `US` or `IT, DE`. The default one is `US`
|
84
85
|
|
85
86
|
`:category` String, example `comedy`. It accept the wildcard `all`, that retrieves videos for all the category for the given nation, or the default one (US) if no one is given
|
@@ -90,32 +91,47 @@ that is the content of the response:
|
|
90
91
|
|
91
92
|
`:order` String, one of these: 'date', 'rating', 'relevance', 'title', 'videocount', 'viewcount'. The default one is `'relevance'`
|
92
93
|
|
93
|
-
It's necessary at least one of this parameters to start a search: `:country`, `:category`, `:query
|
94
|
+
It's necessary at least one of this parameters to start a search: `:country`, `:category`, `:query`
|
94
95
|
|
95
96
|
### Methods
|
96
|
-
`search`, search youtube videos for the given parameters
|
97
|
+
* `search`, search youtube videos for the given parameters
|
97
98
|
```ruby
|
98
99
|
client = Yourub::Client.new
|
99
|
-
client.search(
|
100
|
+
client.search(query: "space missions")
|
100
101
|
```
|
101
102
|
|
102
|
-
`get_views`
|
103
|
-
|
103
|
+
* `get_views`
|
104
|
+
it return the number of views for the given video id
|
104
105
|
```ruby
|
105
106
|
client = Yourub::Client.new
|
106
107
|
client.get_views("G2b0OIkTraI")
|
107
108
|
```
|
109
|
+
* `get_video`
|
110
|
+
retrieves all the metatags available for one
|
111
|
+
```ruby
|
112
|
+
client = Yourub::Client.new
|
113
|
+
client.get_video("G2b0OIkTraI")
|
114
|
+
```
|
108
115
|
|
116
|
+
## Supported Ruby Versions
|
117
|
+
This gem [supports](https://travis-ci.org/edap/yourub) the following Ruby versions:
|
109
118
|
|
119
|
+
* Ruby 1.9.3
|
120
|
+
* Ruby 2.0.0
|
121
|
+
* Ruby 2.1
|
122
|
+
* Ruby 2.2
|
123
|
+
* JRuby 1.7 (in Ruby 1.9 mode)
|
110
124
|
|
111
125
|
##TODO
|
112
|
-
|
113
|
-
|
114
|
-
|
126
|
+
Here there is a [list](https://developers.google.com/youtube/v3/docs/) of the available methods.
|
127
|
+
Currently, this gem implements: [videos.list](https://developers.google.com/youtube/v3/docs/videos/list), [search.list](https://developers.google.com/youtube/v3/docs/search/list) and [videoCategories.list](https://developers.google.com/youtube/v3/docs/videoCategories/list).
|
128
|
+
The next methods that will be implemented are [playlist.list](https://developers.google.com/youtube/v3/docs/playlists/list) and [channelis.list](https://developers.google.com/youtube/v3/docs/channels/list)
|
115
129
|
## Contributing
|
116
130
|
|
117
131
|
1. Fork it
|
118
132
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
119
133
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
120
|
-
4.
|
121
|
-
|
134
|
+
4. Run the test, run the spec/yourub/integration.rb file with a valid developer
|
135
|
+
key
|
136
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
137
|
+
4. Create new Pull Request
|
data/lib/yourub/config.rb
CHANGED
data/lib/yourub/default.rb
CHANGED
data/lib/yourub/rest/request.rb
CHANGED
@@ -3,7 +3,7 @@ module Yourub
|
|
3
3
|
class Request
|
4
4
|
attr_reader :data, :status
|
5
5
|
#
|
6
|
-
# Once initializated, the Request object forward a request to
|
6
|
+
# Once initializated, the Request object forward a request to
|
7
7
|
# youtube api, once the request is completed, the variables @status and @data are populated
|
8
8
|
#
|
9
9
|
# @param client [Yourub::Client]
|
@@ -16,7 +16,7 @@ module Yourub
|
|
16
16
|
# Yourub::REST::Request.new(client,"video_categories", "list", param)
|
17
17
|
#
|
18
18
|
def initialize(client, resource_type, method, params)
|
19
|
-
@client = client
|
19
|
+
@client = client
|
20
20
|
@resource_type = resource_type.to_sym
|
21
21
|
@method = method.to_sym
|
22
22
|
@params = params
|
@@ -33,12 +33,11 @@ private
|
|
33
33
|
# @data [String]
|
34
34
|
#
|
35
35
|
def perform
|
36
|
-
api_method =@client.youtube_api.send(@resource_type).send(@method)
|
36
|
+
api_method =@client.youtube_api.send(@resource_type).send(@method)
|
37
37
|
r = @client.execute!(
|
38
38
|
:api_method => api_method,
|
39
39
|
:parameters => @params
|
40
|
-
)
|
41
|
-
#byebug
|
40
|
+
)
|
42
41
|
@data = r.data
|
43
42
|
@status = r.status
|
44
43
|
end
|
data/lib/yourub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yourub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davide Prati
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|
@@ -47,6 +47,7 @@ extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
50
51
|
- Gemfile
|
51
52
|
- LICENSE.txt
|
52
53
|
- README.md
|
@@ -90,7 +91,6 @@ files:
|
|
90
91
|
- spec/yourub/rest/videos_spec.rb
|
91
92
|
- spec/yourub/validator_spec.rb
|
92
93
|
- yourub.gemspec
|
93
|
-
- yourub.sublime-project
|
94
94
|
homepage: https://github.com/edap/yourub
|
95
95
|
licenses:
|
96
96
|
- MIT
|