marvelite 0.1.0 → 0.1.1
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/CHANGELOG.md +5 -0
- data/README.md +3 -0
- data/lib/marvelite/api/client.rb +1 -0
- data/lib/marvelite/version.rb +1 -1
- data/spec/marvelite/api/client_spec.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fa3e96bed80844b8f93bc232ba7870c72a8ed65
|
4
|
+
data.tar.gz: 09185929b654a41aef73e2f5c21022bbd625e0ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b27af76180a1d2d99216e47f2c421faa28f7bdb79b117bd409ec0c94de72bc20f249e8b5ed9587dc7e4c4f7dfa978d5ee8c8359bcb35211cde45344acc6ecd50
|
7
|
+
data.tar.gz: 953135e4e303d34fe230d643043952501cb75fc32c039644387a674f9497d7ea6b5ef818e11be47cd70ed6e1505383c5ba947e10986033cd7007d828b0f630e5
|
data/CHANGELOG.md
CHANGED
@@ -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. :)
|
data/lib/marvelite/api/client.rb
CHANGED
data/lib/marvelite/version.rb
CHANGED
@@ -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') }
|