comicvine 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -1
- data.tar.gz.sig +0 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/checksum/comicvine-0.1.2.gem.sha256 +1 -0
- data/lib/comicvine.rb +1 -1
- data/lib/comicvine/list.rb +22 -1
- data/lib/comicvine/version.rb +1 -1
- metadata +3 -2
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60008d77105b11f4fd17f4fe4e4128b85f4fe5b9
|
4
|
+
data.tar.gz: abd919160174627857854e96d74e24def8534710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876fa96672cb1e3c242d4e0631e66b4344a0d2f8ba4460f3f7231515aa0df1a85c875508f0bf562f85df774d0e6596b8bc279341277792b00899d118ea56e3fe
|
7
|
+
data.tar.gz: 12993f73937af03d422f89c4c84f640061b1b700787477b9cf366ed4c3373c19ae6485f49aaa6fe477ba0813a430db041381481869c2586c34cd8d8d9eadfc9c
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
J��~�����1�b�)] 4Yl!6킄l
|
2
|
+
[��g�W��{�5�U����Ǎ�s9qK#ۮp�b`��H\�HB=!��\^�y�ҥX�e��Ex�(n^e|+���A�4ZWB�g�;ډ�WSČq�X@���2���Il�kea�*����t��)R��⒍m<�cu��#�R'�\]Z��8Z�^}
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Then set a environmental variable named `CV_API_KEY` to your ComicVine API key *
|
|
29
29
|
If you did not set the env variable `CV_API_KEY` then you need to set the class `api_key` before using. If you did set the env variable you do not need to set this.
|
30
30
|
|
31
31
|
```ruby
|
32
|
-
|
32
|
+
ComicVine::API.api_key = '18357f40df87fb4a4aa6bbbb27cd8ad1deb08d3e'
|
33
33
|
```
|
34
34
|
|
35
35
|
Gather response from a url:
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ end
|
|
19
19
|
# Default task
|
20
20
|
task :default => :test
|
21
21
|
|
22
|
-
|
22
|
+
Rake::Task['build'].enhance do
|
23
23
|
require 'digest/sha2'
|
24
24
|
built_gem_path = 'pkg/comicvine-'+ComicVine::VERSION+'.gem'
|
25
25
|
checksum = Digest::SHA256.new.hexdigest(File.read(built_gem_path))
|
@@ -0,0 +1 @@
|
|
1
|
+
dea289709e7301c6cf562fc44b75d21bd4fe9a7832a45ca7048ef851b0f7022a
|
data/lib/comicvine.rb
CHANGED
@@ -9,7 +9,7 @@ require 'json'
|
|
9
9
|
# @!macro [new] raise.ResourceNotSupportedError
|
10
10
|
# @raise [ResourceNotSupportedError] indicating the resource requested is not supported
|
11
11
|
# @!macro [new] raise.ComicVineAPIError
|
12
|
-
# @raise [ComicVineAPIError] indicating the api request code
|
12
|
+
# @raise [ComicVineAPIError] indicating the api request code received
|
13
13
|
|
14
14
|
##
|
15
15
|
# Base ComicVine module, holds default api variables
|
data/lib/comicvine/list.rb
CHANGED
@@ -27,17 +27,32 @@ module ComicVine
|
|
27
27
|
@cvos.last
|
28
28
|
end
|
29
29
|
|
30
|
+
# Returns the current page the object is on
|
31
|
+
# @return [Integer]
|
30
32
|
def page
|
31
33
|
(@offset / @limit) + 1
|
32
34
|
end
|
33
35
|
|
36
|
+
# Returns the total number of pages available
|
37
|
+
# @return [Integer] Total number of pages
|
38
|
+
# @since 0.1.3
|
39
|
+
def total_pages
|
40
|
+
(self.total_count / self.limit) + 1
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns if there are more pages to load
|
44
|
+
# @return [true, false]
|
45
|
+
# @since 0.1.3
|
46
|
+
def has_more?
|
47
|
+
self.total_pages > self.page ? true : false
|
48
|
+
end
|
49
|
+
|
34
50
|
protected
|
35
51
|
|
36
52
|
def update_ivals(new_cvol)
|
37
53
|
@total_count = new_cvol.total_count
|
38
54
|
@offset = new_cvol.offset
|
39
55
|
@limit = new_cvol.limit
|
40
|
-
|
41
56
|
@cvos = new_cvol.cvos
|
42
57
|
end
|
43
58
|
|
@@ -56,15 +71,21 @@ module ComicVine
|
|
56
71
|
@cvos = resp['results'].map { |r| ComicVine::Resource.create_resource(r) }
|
57
72
|
end
|
58
73
|
|
74
|
+
# Loads the next page results
|
59
75
|
def next_page
|
60
76
|
return nil if (@offset + @page_count) >= @total_count
|
61
77
|
update_ivals(ComicVine::API.send(@resource, {:limit => @limit, :offset => (@offset + @page_count)}))
|
62
78
|
end
|
63
79
|
|
80
|
+
# Loads the previous page results
|
64
81
|
def prev_page
|
65
82
|
return nil if @offset == 0
|
66
83
|
update_ivals(ComicVine::API.send(@resource, {:limit => @limit, :offset => (@offset - @page_count)}))
|
67
84
|
end
|
85
|
+
|
86
|
+
alias_method :next_page!, :next_page
|
87
|
+
alias_method :prev_page!, :prev_page
|
88
|
+
|
68
89
|
end
|
69
90
|
|
70
91
|
##
|
data/lib/comicvine/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comicvine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Holden Omans
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
VpDNqh/BlGMQ0mqAEuBFZFSNaroph6JLUz1ykVvQENOQLThxAjolK7SAUrdoBDOc
|
31
31
|
fXEVP1s+hpJB6IEU8/LW016TU8WpnA+MHGfJRtkrUm/cEsWU
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-11-
|
33
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: bundler
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- certs/homans.pem
|
174
174
|
- checksum/comicvine-0.1.0.gem.sha256
|
175
175
|
- checksum/comicvine-0.1.1.gem.sha256
|
176
|
+
- checksum/comicvine-0.1.2.gem.sha256
|
176
177
|
- comicvine.gemspec
|
177
178
|
- lib/comicvine.rb
|
178
179
|
- lib/comicvine/list.rb
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
��&�9��q��E^L�B�)��0��dQi����*�q�v֮�Ǧ�PǨ������:a�j�~G
|
2
|
+
�5���m%�5+�`_S�=0D3xnv>q�J(�ʆ��*3��6����bՠE�aC�j˥��юk�h��jʊ�D%|+�!`8����2B��h�kdc?Y����j�Ƅ^t��F����@���#�����^1���8B%��}���M/�{����E�1!6Q��̪� ���cS���G��
|