fappu 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +64 -0
  6. data/Rakefile +6 -0
  7. data/fappu.gemspec +27 -0
  8. data/fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_download_url/returns_the_download_link.yml +53 -0
  9. data/fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_related/behaves_like_a_manga_collection/.yml +103 -0
  10. data/fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_related/behaves_like_a_manga_collection/returns_an_array_of_Mangas.yml +103 -0
  11. data/fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_related/should_include_related_manga_related_to_pool_sex.yml +103 -0
  12. data/fixtures/cassettes/Fappu_Tag/_list/.yml +273 -0
  13. data/fixtures/cassettes/Fappu_Tag/_list/should_return_an_array_of_tag_objects.yml +273 -0
  14. data/fixtures/cassettes/connection.yml +203 -0
  15. data/fixtures/cassettes/heck.yml +203 -0
  16. data/fixtures/cassettes/manga.yml +221 -0
  17. data/fixtures/cassettes/manga_read_pool_sex.yml +58 -0
  18. data/fixtures/cassettes/pool_cleaning_comments.yml +107 -0
  19. data/fixtures/cassettes/pool_cleaning_top_comments.yml +107 -0
  20. data/fixtures/cassettes/related_pool_sex_manga.yml +103 -0
  21. data/fixtures/cassettes/search_tagged_netorare.yml +96 -0
  22. data/fixtures/cassettes/search_term_sao.yml +98 -0
  23. data/index.html +0 -0
  24. data/lib/fappu.rb +11 -0
  25. data/lib/fappu/comment.rb +27 -0
  26. data/lib/fappu/connection.rb +21 -0
  27. data/lib/fappu/manga.rb +106 -0
  28. data/lib/fappu/page.rb +29 -0
  29. data/lib/fappu/search.rb +105 -0
  30. data/lib/fappu/tag.rb +33 -0
  31. data/lib/fappu/version.rb +3 -0
  32. data/spec/lib/fappu/connection_spec.rb +23 -0
  33. data/spec/lib/fappu/manga_spec.rb +49 -0
  34. data/spec/lib/fappu/page_spec.rb +18 -0
  35. data/spec/lib/fappu/search_spec.rb +149 -0
  36. data/spec/lib/fappu/tag_spec.rb +14 -0
  37. data/spec/lib/fappu_spec.rb +4 -0
  38. data/spec/shared_examples.rb +10 -0
  39. data/spec/spec_helper.rb +24 -0
  40. metadata +146 -0
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fappu::Manga , vcr: {cassette_name: 'manga'} do
4
+
5
+ context "The manga is 'Right now while cleaning the pool'", vcr: { cassette_name: 'pool_cleaning_comments' } do
6
+ subject(:manga) { described_class.new(url: 'https://www.fakku.net/manga/right-now-while-cleaning-the-pool') }
7
+
8
+ describe "#top_comments" do
9
+ it "has comments" do
10
+ expect(subject.top_comments.length).not_to eq(0)
11
+ end
12
+
13
+ it "returns comment objects" do
14
+ expect(subject.top_comments.first).to be_a_kind_of(Fappu::Comment)
15
+ end
16
+ end
17
+
18
+ describe "#download_url", vcr: 'download_pool_sex' do
19
+ subject { manga.download_url }
20
+ it "returns the download link" do
21
+ is_expected.to include('http://www.sendspace.com/file/d5gd5v')
22
+ end
23
+ end
24
+
25
+ # TODO WIP
26
+ describe "#comments" do
27
+
28
+ subject {manga.comments}
29
+
30
+ it "is not empty"
31
+ it "returns comment objects"
32
+
33
+ end
34
+
35
+ describe "#pages", vcr: {cassette_name: 'manga_read_pool_sex'} do
36
+ subject {manga.pages}
37
+ it { is_expected.not_to be_empty}
38
+ it "returns page objects" do
39
+ expect(subject.first).to be_a_kind_of(Fappu::Page)
40
+ expect(subject.first).to have_attributes(
41
+ page_number: '1',
42
+ image_url: 'https://t.fakku.net/images/manga/r/[Yamatogawa]_Original_Work_-_Right_now,_while_cleaning_the_pool/images/001.jpg',
43
+ thumbnail_url: 'https://t.fakku.net/images/manga/r/[Yamatogawa]_Original_Work_-_Right_now,_while_cleaning_the_pool/thumbs/001.thumb.jpg'
44
+ )
45
+ end
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fappu::Page do
4
+ describe "#new_from_json" do
5
+ let(:args) { {'1' => {'image' => 'http://a.url.com', 'thumb' => 'http://a.thumb_url.com'}}}
6
+ subject{ described_class.new_from_json(args) }
7
+
8
+ it { is_expected.to be_an_instance_of(described_class) }
9
+ it { is_expected.to have_attributes(
10
+ page_number: '1',
11
+ image_url: 'http://a.url.com',
12
+ thumbnail_url: 'http://a.thumb_url.com'
13
+ )}
14
+
15
+ end
16
+
17
+ end
18
+
@@ -0,0 +1,149 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fappu::Search do
4
+
5
+ describe '.related' do
6
+ context "Pool sex manga", vcr: {cassette_name: 'related_pool_sex_manga' }do
7
+ let(:manga) { Fappu::Manga.new(url: 'https://www.fakku.net/manga/right-now-while-cleaning-the-pool')}
8
+ subject { described_class.related(manga) }
9
+
10
+ it_behaves_like "a manga collection"
11
+
12
+ it "should include related manga related to pool sex" do
13
+ expect(subject.collect(&:title)).to include(
14
+ "Before the Pool Opens",
15
+ "I'll let you do it on the pool-side",
16
+ "Summer Time Sexy Girl",
17
+ "Two Piecies")
18
+ end
19
+ end
20
+ end
21
+
22
+ describe '.tagged', vcr: {cassette_name: 'search_tagged_netorare'} do
23
+ context "In the mood for some Netorare" do
24
+ let(:tag) { 'Netorare' }
25
+ subject { described_class.tagged(tag) }
26
+
27
+ it_behaves_like "a manga collection"
28
+
29
+ it "should include 'Yuru Bitch', 'Shujou Seikou II'" do
30
+ expect(subject.map(&:title)).to include('Shujou Seikou II β', 'Yuru Bitch')
31
+ end
32
+
33
+ end
34
+ end
35
+
36
+ describe '.terms' do
37
+ context "Searching for SAO manga", vcr: {cassette_name: 'search_term_sao'} do
38
+ let(:search_terms) { "Sword Art Online"}
39
+ subject {described_class.terms(search_terms)}
40
+
41
+ it_behaves_like "a manga collection"
42
+
43
+ it "returns an array of SAO mangas" do
44
+ expect(subject.map(&:title)).to include(
45
+ "Sword Art Unlimited",
46
+ "Sword Art Offline -Silica Route-",
47
+ "Sword Art Extra",
48
+ "SPECIAL ASUNA ONLINE 2",
49
+ "Sister Affection Online",
50
+ "Lisbeth... Kirito ni wa Suterare, Kyaku ni wa Okasare Nakadashi Ninshin... Asuna to no Kakusa ga Hirogaru Online",
51
+ "Asuna to Online",
52
+ "KARORFUL MIX EX10",
53
+ "KARORFUL MIX EX9",
54
+ "no passage"
55
+ )
56
+ end
57
+
58
+ end
59
+ end
60
+
61
+ describe ".latest", vcr: {cassette_name: 'manga'} do
62
+ subject { described_class.latest }
63
+ it_behaves_like "a manga collection"
64
+
65
+ context "The first manga in the 'latest' list is 'My Mountain Village Journal Chapter 1'" do
66
+ subject { described_class.latest.first }
67
+
68
+ it "is tagged" do
69
+ subject.tags.each do |tag|
70
+ expect(tag).to be_an_instance_of(Fappu::Tag)
71
+ end
72
+
73
+ expect(subject.tags.collect(&:name)).to include('Paizuri', 'Oral',
74
+ 'Oppai', 'Hentai',
75
+ 'Ahegao'
76
+ )
77
+ end
78
+
79
+ it "Assigns the correct values to the object" do
80
+ is_expected.to have_attributes(
81
+ title: "My Mountain Village Journal Chapter 1",
82
+ url: "http://www.fakku.net/manga/my-mountain-village-journal-chapter-1-english-1407126681",
83
+ description: "Commissioned by hentai2read.com",
84
+ language: "english",
85
+ category: "manga",
86
+ date: 1407126681,
87
+ filesize: 18129800,
88
+ favorites: 0,
89
+ comment_count: 0,
90
+ page_count: 21,
91
+ poster: "LustyLady00",
92
+ poster_url: "http://www.fakku.net/users/lustylady00",
93
+ translators: include(
94
+ {"attribute" => "Lazarus H", "attribute_link" => "/translators/lazarus-h"}
95
+ ),
96
+ series: include(
97
+ {"attribute" => "Original Work", "attribute_link" => "/series/original-work"},
98
+ ),
99
+ artists: include(
100
+ {"attribute" => "Hiroyuki Kai", "attribute_link" => "/artists/hiroyuki-kai"},
101
+ {"attribute" => "kai hiroyuki", "attribute_link" => "/artists/kai-hiroyuki"}
102
+ ),
103
+ images: include(
104
+ {
105
+ "cover" => "https://t.fakku.net/images/manga/m/[Hiroyuki_Kai,_kai_hiroyuki]_Original_Work_-_My_Mountain_Village_Journal_Chapter_1_1407126682/thumbs/001.thumb.jpg",
106
+ "sample" => "https://t.fakku.net/images/manga/m/[Hiroyuki_Kai,_kai_hiroyuki]_Original_Work_-_My_Mountain_Village_Journal_Chapter_1_1407126682/thumbs/002.thumb.jpg"
107
+ }
108
+ )
109
+ )
110
+ end
111
+ end
112
+ end
113
+
114
+ describe ".favorites",vcr: {cassette_name: 'manga'} do
115
+ subject { described_class.favorites }
116
+
117
+ it_behaves_like "a manga collection"
118
+
119
+ context "Tiny boobs is the first favorite" do
120
+ subject { described_class.favorites.first }
121
+ it { is_expected.to have_attributes(title: "Tiny Boobs Giant Tits History") }
122
+ end
123
+ end
124
+
125
+
126
+ describe ".popular" ,vcr: {cassette_name: 'manga'} do
127
+ subject { described_class.popular }
128
+
129
+ it_behaves_like "a manga collection"
130
+
131
+ context "This siscon manga with extremely long title is in the list" do
132
+ subject { described_class.popular.first }
133
+ it {
134
+ is_expected.to have_attributes(title: "More than a little sister, less than a friend? / More than a little sister, less than a bride?")
135
+ }
136
+ end
137
+ end
138
+
139
+ describe ".controversial" ,vcr: {cassette_name: 'manga'} do
140
+ subject { described_class.controversial }
141
+
142
+ it_behaves_like "a manga collection"
143
+
144
+ context "Maso Mess is first in the list of the controversial manga" do
145
+ subject { described_class.controversial.first }
146
+ it { is_expected.to have_attributes(title: "Maso Mess Ch14") }
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fappu::Tag do
4
+ describe '.list', vcr: 'taglist' do
5
+ subject { described_class.list }
6
+
7
+ it { is_expected.not_to be_empty }
8
+ it "should return an array of tag objects" do
9
+ expect(subject.first).to be_a_kind_of(described_class)
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -0,0 +1,4 @@
1
+ require 'fappu'
2
+
3
+ describe Fappu do
4
+ end
@@ -0,0 +1,10 @@
1
+ shared_examples 'a manga collection' do
2
+
3
+ it { is_expected.not_to be_empty }
4
+ it "returns an array of Mangas" do
5
+ subject.each do |item|
6
+ expect(item).to be_a_kind_of(Fappu::Manga)
7
+ end
8
+ end
9
+
10
+ end
@@ -0,0 +1,24 @@
1
+ require 'bundler/setup'
2
+ require 'vcr'
3
+ require 'pry'
4
+ require 'ostruct'
5
+
6
+ Bundler.setup
7
+
8
+ require 'fappu'
9
+ require 'shared_examples'
10
+
11
+
12
+ VCR.configure do |vcr|
13
+ vcr.cassette_library_dir = 'fixtures/cassettes'
14
+ vcr.default_cassette_options = {record: :once}
15
+ vcr.configure_rspec_metadata!
16
+ vcr.hook_into :webmock
17
+ end
18
+
19
+ RSpec.configure do |config|
20
+ config.color = true
21
+ config.tty = true
22
+ config.failure_color = :magenta
23
+ # optional config here
24
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fappu
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Buddy Magsipoc
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vcr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 2.9.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.9.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Gem to access the FAKKU API
70
+ email:
71
+ - keikun17@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - fappu.gemspec
82
+ - fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_download_url/returns_the_download_link.yml
83
+ - fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_related/behaves_like_a_manga_collection/.yml
84
+ - fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_related/behaves_like_a_manga_collection/returns_an_array_of_Mangas.yml
85
+ - fixtures/cassettes/Fappu_Manga/The_manga_is_Right_now_while_cleaning_the_pool_/_related/should_include_related_manga_related_to_pool_sex.yml
86
+ - fixtures/cassettes/Fappu_Tag/_list/.yml
87
+ - fixtures/cassettes/Fappu_Tag/_list/should_return_an_array_of_tag_objects.yml
88
+ - fixtures/cassettes/connection.yml
89
+ - fixtures/cassettes/heck.yml
90
+ - fixtures/cassettes/manga.yml
91
+ - fixtures/cassettes/manga_read_pool_sex.yml
92
+ - fixtures/cassettes/pool_cleaning_comments.yml
93
+ - fixtures/cassettes/pool_cleaning_top_comments.yml
94
+ - fixtures/cassettes/related_pool_sex_manga.yml
95
+ - fixtures/cassettes/search_tagged_netorare.yml
96
+ - fixtures/cassettes/search_term_sao.yml
97
+ - index.html
98
+ - lib/fappu.rb
99
+ - lib/fappu/comment.rb
100
+ - lib/fappu/connection.rb
101
+ - lib/fappu/manga.rb
102
+ - lib/fappu/page.rb
103
+ - lib/fappu/search.rb
104
+ - lib/fappu/tag.rb
105
+ - lib/fappu/version.rb
106
+ - spec/lib/fappu/connection_spec.rb
107
+ - spec/lib/fappu/manga_spec.rb
108
+ - spec/lib/fappu/page_spec.rb
109
+ - spec/lib/fappu/search_spec.rb
110
+ - spec/lib/fappu/tag_spec.rb
111
+ - spec/lib/fappu_spec.rb
112
+ - spec/shared_examples.rb
113
+ - spec/spec_helper.rb
114
+ homepage: https://github.com/keikun17/fappu
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.4.1
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: FAKKU ruby client
138
+ test_files:
139
+ - spec/lib/fappu/connection_spec.rb
140
+ - spec/lib/fappu/manga_spec.rb
141
+ - spec/lib/fappu/page_spec.rb
142
+ - spec/lib/fappu/search_spec.rb
143
+ - spec/lib/fappu/tag_spec.rb
144
+ - spec/lib/fappu_spec.rb
145
+ - spec/shared_examples.rb
146
+ - spec/spec_helper.rb