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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b853ef9a066f23008e9a9c8dce147714133d01c
4
- data.tar.gz: 2dd9897234f1313c78e29439697627f8dc08dbe6
3
+ metadata.gz: 60008d77105b11f4fd17f4fe4e4128b85f4fe5b9
4
+ data.tar.gz: abd919160174627857854e96d74e24def8534710
5
5
  SHA512:
6
- metadata.gz: 1e01d4e5a1c09b824ff07dfecf91af1b891713a96247b2bac236a261886885f6ad0c8a376fed54476cc98365b9874cd86f69b243899a82e0e5c61e15cfeeec88
7
- data.tar.gz: c30f5d767bb36b32956858e5eba92dcc34d9cc8ed3e571da4cbd6e128ea4f896f01c5f2951e7be0ea98d385eea48a3877607ae28b4ee23923bd0af026b51f83a
6
+ metadata.gz: 876fa96672cb1e3c242d4e0631e66b4344a0d2f8ba4460f3f7231515aa0df1a85c875508f0bf562f85df774d0e6596b8bc279341277792b00899d118ea56e3fe
7
+ data.tar.gz: 12993f73937af03d422f89c4c84f640061b1b700787477b9cf366ed4c3373c19ae6485f49aaa6fe477ba0813a430db041381481869c2586c34cd8d8d9eadfc9c
@@ -1 +1,2 @@
1
- FX_����iMm IN;�~<���N�\l����㘟��X^N��3T�q$�ݩ�A]���~�+������mJ��M���s��u4�S^��{I|���PR��Tw�^Q�Ja�S�_&�T���%M�Cs�_?��Uq�!Ǚ���ކ��W�R4?�$��s�A� U�q�j-;ņ�+U}�Ҷ������˅�^��x: *v
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
- resp = ComicVine::API.api_key = '18357f40df87fb4a4aa6bbbb27cd8ad1deb08d3e'
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
- task :gen_checksum do
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
@@ -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 recived
12
+ # @raise [ComicVineAPIError] indicating the api request code received
13
13
 
14
14
  ##
15
15
  # Base ComicVine module, holds default api variables
@@ -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
  ##
@@ -1,4 +1,4 @@
1
1
  module ComicVine
2
2
  # Current gem version number
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
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.2
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-16 00:00:00.000000000 Z
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
- Wi4���\/h�i X�׮�<F%{�x�.�"α�h�=����:L���@�j��S�wSN�++ {�.��H���ymH�P7�1��t��
2
- Me���yu]��7Q|��6j��e��&�]W���&���ܼ��KA��.D<�޿J� o�����D�º��7�⌀�"7&H��m蝗]c����h�C�V+I��e�
1
+ ��&�9��q��E^L�B)��0��d Qi����*�qv֮�Ǧ�PǨ������:aj�~G
2
+ 5���m%�5+�`_S�=0D3xnv>qJ(�ʆ��*3��6����bՠEaCj˥��юkh� jʊ�D%|+�!`8����2B��h�kdc?Y����j�Ƅ^t��F����@���#�����^1���8B%��}���M/�{����E1!6Q��̪� ���cS���G��