t411 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/lib/t411/torrents.rb +7 -20
- data/lib/t411/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1efd77610ac402fe8352e9eea5b43a047dc409ca
|
4
|
+
data.tar.gz: 0c5d20775e48acf4683ac574e0957204eec9ae9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72f682306353b36f149290f7dfd87be047fbdec2dbfed2823d67b3839e8d2e169766663fd8f69f8bb39b1212a774dbf8d40793bc4fa6ab5de6ed79ef8a9c29e5
|
7
|
+
data.tar.gz: 3f8736ca236c9550d68c077e4ec0347da42eb574a7822f88c259f2a93fa57b8f66911956481bc91da7cf8404f0fd674e251111a3805191849efe4fd2fed2c550
|
data/README.md
CHANGED
@@ -45,13 +45,15 @@ Get all terms
|
|
45
45
|
{"234":{"11":{"type":"Application - Genre","mode":"single","terms":{"152":"Contr\u00f4le parental","184":"Science","1062":"Permis","163":"G\u00e9n\u00e9alogie","131":"Anonymat","174":"Nettoyage et Opti
|
46
46
|
|
47
47
|
#### Search
|
48
|
-
Search a torrent based on name, limit
|
48
|
+
Search a torrent based on name, limit and category id are optional. Default limit = 100
|
49
49
|
|
50
|
-
T411::Torrents.search('debian',25)
|
50
|
+
T411::Torrents.search('debian', limit: 25)
|
51
51
|
{"query":"debian","offset":0,"limit":"25","total":"13","torrents":[{"id":"4856719","name":"Debian 7.0 - \"Wheezy\" - amd64-netinst LITE","category":"234","rewritename":"debian-7-0-wheezy-amd64-netinst-
|
52
52
|
|
53
|
-
T411::Torrents.
|
54
|
-
{"query":"debian","offset":0,"limit":"
|
53
|
+
T411::Torrents.search('debian', cid: 234)
|
54
|
+
{"query":"debian","offset":0,"limit":"100","total":"9","torrents":[{"id":"4856719","name":"Debian 7.0 - \"Wheezy\" - amd64-netinst LITE","category":"234","rewritename":"debian-7-0-wheezy-amd64-netinst-l
|
55
|
+
|
56
|
+
T411::Torrents.search('debian', cid: 234, limit: 10)
|
55
57
|
|
56
58
|
#### Details
|
57
59
|
Details of a torrent
|
@@ -72,6 +74,8 @@ Download the torrent file. Path is optional, default = current working directory
|
|
72
74
|
|
73
75
|
T411::Torrents.month
|
74
76
|
|
77
|
+
T411::Torrents.week
|
78
|
+
|
75
79
|
### Bookmarks
|
76
80
|
|
77
81
|
#### Save
|
data/lib/t411/torrents.rb
CHANGED
@@ -6,20 +6,15 @@ module T411
|
|
6
6
|
define_method(:"#{request}") {T411::Api.request_data(URI.parse($t411_base_url + "/#{request}/tree"))}
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
12
|
-
req = Net::HTTP::Get.new("/torrents/search/#{query.gsub(' ','+')}?&limit=#{limit}")
|
13
|
-
req['Authorization'] = T411::Api.shared_token
|
14
|
-
http.request(req).body
|
9
|
+
%w(today week month top100).each do |request|
|
10
|
+
define_method(:"#{request}") {T411::Api.request_data(URI.parse($t411_base_url + "/torrents/top/#{request.gsub('top100','100')}"))}
|
15
11
|
end
|
16
12
|
|
17
|
-
def self.
|
18
|
-
|
19
|
-
|
20
|
-
req = Net::HTTP::Get.new(
|
21
|
-
|
22
|
-
http.request(req).body
|
13
|
+
def self.search(query, options={})
|
14
|
+
options = {limit: 100, cid: nil}.merge(options)
|
15
|
+
path = "/torrents/search/#{query.gsub(' ','+')}?&limit=#{options[:limit]}&cid=#{options[:cid]}" if options[:cid] != nil && options[:cid].is_a?(Integer) || "/torrents/search/#{query.gsub(' ','+')}?&limit=#{options[:limit]}"
|
16
|
+
req = Net::HTTP::Get.new(path); req['Authorization'] = T411::Api.shared_token
|
17
|
+
Net::HTTP.new($t411_base_url.gsub('http://','')).request(req).body
|
23
18
|
end
|
24
19
|
|
25
20
|
def self.details(id)
|
@@ -32,15 +27,7 @@ module T411
|
|
32
27
|
end
|
33
28
|
end
|
34
29
|
|
35
|
-
def self.top100
|
36
|
-
T411::Api.request_data(URI.parse($t411_base_url + '/torrents/top/100'))
|
37
|
-
end
|
38
|
-
|
39
|
-
%w(today month).each do |request|
|
40
|
-
define_method(:"#{request}") {T411::Api.request_data(URI.parse($t411_base_url + "/torrents/top/#{request}"))}
|
41
|
-
end
|
42
30
|
end
|
43
31
|
end
|
44
32
|
|
45
33
|
|
46
|
-
|
data/lib/t411/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t411
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christophe Augello
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|