crankshaft 0.0.1 → 0.0.2
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.
- data/LICENSE +2 -0
- data/lib/crankshaft/torrent.rb +9 -3
- data/lib/crankshaft/version.rb +1 -1
- metadata +3 -7
data/LICENSE
CHANGED
data/lib/crankshaft/torrent.rb
CHANGED
@@ -11,7 +11,9 @@ module Crankshaft
|
|
11
11
|
|
12
12
|
def initialize(session, attrs = {})
|
13
13
|
@session = session
|
14
|
-
@attrs = attrs
|
14
|
+
@attrs = attrs.keys.inject({}) do |hash, key|
|
15
|
+
hash.tap {|h| h[key.to_sym] = attrs[key] }
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
19
|
# Actions
|
@@ -39,7 +41,7 @@ module Crankshaft
|
|
39
41
|
|
40
42
|
def remove(delete = false)
|
41
43
|
arguments = { :ids => [ self['id'] ], 'delete-local-data' => delete }
|
42
|
-
@session.execute('torrent-
|
44
|
+
@session.execute('torrent-remove', arguments)
|
43
45
|
end
|
44
46
|
|
45
47
|
|
@@ -47,16 +49,20 @@ module Crankshaft
|
|
47
49
|
# ----------
|
48
50
|
|
49
51
|
def [](attribute)
|
52
|
+
attribute = attribute.to_sym
|
50
53
|
return @attrs[attribute] if @attrs.include?(attribute)
|
51
54
|
|
52
55
|
arguments = { :ids => [ self['id'] ], :fields => [ attribute ] }
|
53
56
|
response = @session.execute('torrent-get', arguments)
|
54
57
|
if response['result'] == 'success'
|
55
58
|
attrs = response['arguments']['torrents'][0]
|
56
|
-
return attrs[attribute]
|
59
|
+
return attrs[attribute.to_s]
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
63
|
+
def method_missing(method, *args)
|
64
|
+
self[method]
|
65
|
+
end
|
60
66
|
|
61
67
|
# Files
|
62
68
|
# -----
|
data/lib/crankshaft/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crankshaft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 29
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Tomas Carnecky
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-20 00:00:00 +01:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
@@ -63,7 +61,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
61
|
requirements:
|
64
62
|
- - ">="
|
65
63
|
- !ruby/object:Gem::Version
|
66
|
-
hash: 3
|
67
64
|
segments:
|
68
65
|
- 0
|
69
66
|
version: "0"
|
@@ -72,7 +69,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
69
|
requirements:
|
73
70
|
- - ">="
|
74
71
|
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
76
72
|
segments:
|
77
73
|
- 0
|
78
74
|
version: "0"
|