marvelite 0.1.0 → 0.1.1

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: 1a25275235911ff6c298db40d9a53cbdba48da58
4
- data.tar.gz: 704f6f949a889ed333d996af13223fcda8a96b06
3
+ metadata.gz: 7fa3e96bed80844b8f93bc232ba7870c72a8ed65
4
+ data.tar.gz: 09185929b654a41aef73e2f5c21022bbd625e0ac
5
5
  SHA512:
6
- metadata.gz: 9057f0a8b511dced1d1865cca70270c80c86ac8befdad542e2592b8c5b37b0be845e318b7c43a5fbcf61f3a3e85a15e72baadff99905e991ec920ab470bc78f5
7
- data.tar.gz: 265c411137e5af68cd206be287ba5c50bbf2874dec5a4703a2a6463f0259bc64021be5ea8e93e0bd8ba4c9771a9b308b1464b74ad1094f3ec68aff456cd137c9
6
+ metadata.gz: b27af76180a1d2d99216e47f2c421faa28f7bdb79b117bd409ec0c94de72bc20f249e8b5ed9587dc7e4c4f7dfa978d5ee8c8359bcb35211cde45344acc6ecd50
7
+ data.tar.gz: 953135e4e303d34fe230d643043952501cb75fc32c039644387a674f9497d7ea6b5ef818e11be47cd70ed6e1505383c5ba947e10986033cd7007d828b0f630e5
@@ -1,5 +1,10 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.1.1
4
+ * Gzipped responses are enabled by default.
5
+ * All API requests include `{ 'Accept-Encoding' = 'gzip' }` which translates
6
+ in faster and band-width conscious responses.
7
+
3
8
  ### 0.1.0
4
9
  * Adds Travis CI support.
5
10
  * Support for Etags and Gzip compression. Infinite thanks to [Jon Allured](https://github.com/jonallured) for this contribution.
data/README.md CHANGED
@@ -140,6 +140,9 @@ second_response = client.series headers: { 'If-None-Match' => first_response.eta
140
140
  second_response.status # => 304
141
141
  ```
142
142
 
143
+ Gzip compressed responses are enabled by default. But if you feel more
144
+ comfortable passing it explicitely, you can do it like this:
145
+
143
146
  ```ruby
144
147
  gzipped_response = client.series(:headers => {'Accept-Encoding' => 'gzip'})
145
148
  #=> Faster response hash from Marvel's API series endpoint. :)
@@ -59,6 +59,7 @@ module Marvelite
59
59
 
60
60
  def pull_headers(options)
61
61
  headers = options.delete(:headers) || {}
62
+ headers.merge!({ 'Accept-Encoding' => 'gzip' }) unless headers['Accept-Encoding']
62
63
  [options, headers]
63
64
  end
64
65
 
@@ -1,3 +1,3 @@
1
1
  module Marvelite
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -62,6 +62,24 @@ describe Marvelite::API::Client do
62
62
  end
63
63
  end
64
64
 
65
+ describe 'gzip compression support' do
66
+ let(:client) { marvelite_test_client }
67
+ let(:options) { {:id => 123} }
68
+
69
+ it 'is enabled by default' do
70
+ expect(client.send(:pull_headers, options)).to eq(
71
+ [{ :id => 123 }, { 'Accept-Encoding' => 'gzip' }]
72
+ )
73
+ end
74
+
75
+ it 'can be passed in explicitely' do
76
+ gzip_options = { :id => 234, :headers => { 'Accept-Encoding' => 'gzip' } }
77
+ expect(client.send(:pull_headers, gzip_options)).to eq(
78
+ [{ :id => 234 }, { 'Accept-Encoding' => 'gzip' }]
79
+ )
80
+ end
81
+ end
82
+
65
83
  context "private methods" do
66
84
  describe '#ts' do
67
85
  let(:client) { Marvelite::API::Client.new(:public_key => '1234', :private_key => 'abcd') }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marvelite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Antillon