assonnato 0.5 → 0.6
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/lib/assonnato/type/show.rb +30 -2
- data/lib/assonnato/version.rb +1 -1
- data/spec/show_spec.rb +15 -8
- 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: 484942eb226ba61bef25c07194237ae08ba67c86
|
4
|
+
data.tar.gz: 771ca979395c5c0f66f4a365c0ad29b248eba7d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b65a99929164a70dfd40bd53793d2b8e9246f50c4cc8d18bcb292e48f1020d840890e420dd96ce55e30ca123fc00fb7d7c899d8b34fdb1a6a8f2d53f7318107
|
7
|
+
data.tar.gz: 2e4f7bf18cf6187ab947912b2829e30008f289ca0c502df54ceda31d32164a2bcf6521e7fb53751b15591eb9eabcb3007ce426707362799a8f575ad0b5451c48
|
data/lib/assonnato/type/show.rb
CHANGED
@@ -19,8 +19,21 @@ module Assonnato
|
|
19
19
|
@path = path || '/api/v1'
|
20
20
|
end
|
21
21
|
|
22
|
-
def all!(status = :ongoing,
|
23
|
-
|
22
|
+
def all!(status = :ongoing, options = {})
|
23
|
+
filters = ''.tap { |str|
|
24
|
+
if options.has_key? :fansub
|
25
|
+
str << by_fansub(options[:fansub])
|
26
|
+
elsif options.has_key? :user
|
27
|
+
if options.has_key? :role
|
28
|
+
str << by_role(options[:user], options[:role])
|
29
|
+
else
|
30
|
+
str << by_staff(options[:user])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
}
|
34
|
+
|
35
|
+
puts "#{filters}/shows/all/#{status}"
|
36
|
+
parse get(@host, @path, "#{filters}/shows/all/#{status}")
|
24
37
|
end
|
25
38
|
|
26
39
|
def search!(keyword)
|
@@ -32,5 +45,20 @@ module Assonnato
|
|
32
45
|
show.name == show_name
|
33
46
|
}
|
34
47
|
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def by_fansub(fansub)
|
51
|
+
"/fansubs/#{URI.escape fansub}"
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def by_staff(user)
|
56
|
+
"/users/#{URI.escape user}"
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
def by_role(user, role)
|
61
|
+
"/users/#{URI.escape user}/#{role}"
|
62
|
+
end
|
35
63
|
end
|
36
64
|
end
|
data/lib/assonnato/version.rb
CHANGED
data/spec/show_spec.rb
CHANGED
@@ -14,26 +14,33 @@ describe 'Assonnato' do
|
|
14
14
|
res.first.status.should eql('ongoing')
|
15
15
|
end
|
16
16
|
|
17
|
+
it 'search all the shows which name is similar to the given keyword' do
|
18
|
+
res = @show.search! 'strike'
|
19
|
+
res.should be_kind_of(Array)
|
20
|
+
res.should_not be_empty
|
21
|
+
res.first.should be_kind_of(Struct)
|
22
|
+
res.first.name.should eql('Strike the Blood')
|
23
|
+
end
|
24
|
+
|
17
25
|
it 'returns all the ongoing shows of the given fansub' do
|
18
|
-
res = @show.all! :ongoing, 'Omnivium'
|
26
|
+
res = @show.all! :ongoing, fansub: 'Omnivium'
|
19
27
|
res.should be_kind_of(Array)
|
20
28
|
res.should_not be_empty
|
21
29
|
res.first.should be_kind_of(Struct)
|
22
30
|
res.first.fansub.should eql('Omnivium')
|
23
31
|
end
|
24
32
|
|
25
|
-
it '
|
26
|
-
res = @show.
|
33
|
+
it 'returns all the ongoing shows in wich the given user has worked' do
|
34
|
+
res = @show.all! :ongoing, user: 'Roxas Shadow'
|
27
35
|
res.should be_kind_of(Array)
|
28
36
|
res.should_not be_empty
|
29
|
-
res.first.should be_kind_of(Struct)
|
30
|
-
res.first.name.should eql('Strike the Blood')
|
31
37
|
end
|
32
38
|
|
33
|
-
it '
|
34
|
-
res = @show.
|
39
|
+
it 'returns all the ongoing shows in wich the given user has worked in the given role' do
|
40
|
+
res = @show.all! :ongoing, { user: 'Roxas Shadow', role: :translator }
|
35
41
|
res.should be_kind_of(Array)
|
36
|
-
res.
|
42
|
+
res.should_not be_empty
|
43
|
+
res.first.translator.should eql('Roxas Shadow')
|
37
44
|
end
|
38
45
|
|
39
46
|
it 'returns all the informations of the given show' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assonnato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|