intelipost-rb 0.0.9 → 0.0.10

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: 8fca173b390a7dcf9ded781290d1bba55eb454b4
4
- data.tar.gz: 7f018f1958cf404dfb877afe4c04f7b253a686e6
3
+ metadata.gz: 9f75b4adac21fe2def1066be2374b9122a8fc704
4
+ data.tar.gz: e8064d182a6f2b76e35acc234ddd4a321e11bf84
5
5
  SHA512:
6
- metadata.gz: 97f894aa75b607930444b30345dc1bf8c816ea03544644cd1b9aa34deb927f23136ab73eadaae1b68090c2808524fbf4121b8176138a4b49eb791b56a62a2c5f
7
- data.tar.gz: ee175f252338a6b157f0f385a281fda08b440df49559b8db576cd2f3291f8a36fdf2b5a4bf13ae218af3f30ba1d20f7bd33e7536855ba5acd7e525490415b363
6
+ metadata.gz: e9fe98aa914a191568d8681a3378c71f60f639c0714436f3fe4b8043c23c43c3179a56f84ff9849e4040c557533441c5d4a5f70575d38f1e16bf2696f0977906
7
+ data.tar.gz: c5b94fb61a521a75be357b2d717137620c98e46074f9171ad4d4479a1d6553ae332e698d8b75646f1c6cc53a59ec69e4568b2c5a70c739a478e5478153685337
data/.travis.yml CHANGED
@@ -6,7 +6,9 @@ rvm:
6
6
  - 2.0.0
7
7
  - 2.1
8
8
  - 2.2
9
- - 2.3
9
+ - 2.3.3
10
+ - 2.4.0
11
+ - ruby-head
10
12
  - jruby-head
11
13
  - rbx-2
12
14
  - ruby-head
@@ -23,8 +25,10 @@ matrix:
23
25
  allow_failures:
24
26
  - rvm: jruby-head
25
27
  - rvm: rbx-2
28
+ - rvm: ruby-head
29
+ - rvm: 2.4.0
26
30
  fast_finish: true
27
31
 
28
32
  addons:
29
33
  code_climate:
30
- repo_token: 6ae54518b280ed0fe7aab012f10000f75e2684e62c306785a9ca54954b1faccc
34
+ repo_token: 79945a23e353c668553e647df658770b978c7729fb1fa7ab69bc7cfe391d99c2
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- [![Gem Version](https://badge.fury.io/rb/intelipost.svg)](http://badge.fury.io/rb/intelipost)
2
- [![Build Status](https://travis-ci.org/natuelabs/intelipost.svg?branch=master)](https://travis-ci.org/natuelabs/intelipost)
3
- [![Code Climate](https://codeclimate.com/github/natuelabs/intelipost/badges/gpa.svg)](https://codeclimate.com/github/natuelabs/intelipost)
4
- [![Test Coverage](https://codeclimate.com/github/natuelabs/intelipost/badges/coverage.svg)](https://codeclimate.com/github/natuelabs/intelipost/coverage)
1
+ [![Gem Version](https://badge.fury.io/rb/intelipost-rb.svg)](http://badge.fury.io/rb/intelipost-rb)
2
+ [![Build Status](https://travis-ci.org/Gaveteiro/intelipost-rb.svg?branch=master)](https://travis-ci.org/Gaveteiro/intelipost-rb)
3
+ [![Code Climate](https://codeclimate.com/github/Gaveteiro/intelipost-rb/badges/gpa.svg)](https://codeclimate.com/github/Gaveteiro/intelipost-rb)
4
+ [![Test Coverage](https://codeclimate.com/github/Gaveteiro/intelipost-rb/badges/coverage.svg)](https://codeclimate.com/github/Gaveteiro/intelipost-rb/coverage)
5
5
 
6
6
 
7
- # intelipost
7
+ # Intelipost
8
8
  Gem for the Intelipost API
9
9
 
10
10
  ### Usage:
data/lib/intelipost.rb CHANGED
@@ -2,7 +2,7 @@ require 'uri'
2
2
  require 'hashie'
3
3
  require 'faraday'
4
4
  require 'faraday_middleware'
5
- require 'middleware/gzip'
5
+
6
6
  require 'intelipost/version'
7
7
  require 'intelipost/fluent_interface'
8
8
  require 'intelipost/client'
@@ -23,7 +23,6 @@ module Intelipost
23
23
  def connection
24
24
  raise ArgumentError, "an api_key is required to connect" if api_key.nil?
25
25
 
26
- Faraday::Middleware.register_middleware gzip: lambda { FaradayMiddleware::Gzip }
27
26
  Faraday.new(url: @uri.to_s) do |conn|
28
27
  conn.request :json
29
28
 
@@ -1,3 +1,3 @@
1
1
  module Intelipost
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intelipost-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Celestino Gomes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-15 00:00:00.000000000 Z
12
+ date: 2017-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -190,7 +190,6 @@ files:
190
190
  - lib/intelipost/quote.rb
191
191
  - lib/intelipost/shipment_order.rb
192
192
  - lib/intelipost/version.rb
193
- - lib/middleware/gzip.rb
194
193
  - spec/lib/intelipost/cep_spec.rb
195
194
  - spec/lib/intelipost/client_spec.rb
196
195
  - spec/lib/intelipost/mash_spec.rb
@@ -217,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
216
  version: '0'
218
217
  requirements: []
219
218
  rubyforge_project:
220
- rubygems_version: 2.5.2
219
+ rubygems_version: 2.6.8
221
220
  signing_key:
222
221
  specification_version: 4
223
222
  summary: Gem to access the REST API of Intelipost
@@ -1,56 +0,0 @@
1
- module FaradayMiddleware
2
- # TODO: Remove this file and the related line on the client.rb
3
- # it was only added because faraday_middleware has not released
4
- # a gem version including this specific middleware.
5
- #
6
- # Middleware to automatically decompress response bodies. If the
7
- # "Accept-Encoding" header wasn't set in the request, this sets it to
8
- # "gzip,deflate" and appropriately handles the compressed response from the
9
- # server. This resembles what Ruby 1.9+ does internally in Net::HTTP#get.
10
- #
11
- # This middleware is NOT necessary when these adapters are used:
12
- # - net_http on Ruby 1.9+
13
- # - net_http_persistent on Ruby 2.0+
14
- # - em_http
15
- class Gzip < Faraday::Middleware
16
- dependency 'zlib'
17
-
18
- ACCEPT_ENCODING = 'Accept-Encoding'.freeze
19
- CONTENT_ENCODING = 'Content-Encoding'.freeze
20
- CONTENT_LENGTH = 'Content-Length'.freeze
21
- SUPPORTED_ENCODINGS = 'gzip,deflate'.freeze
22
- RUBY_ENCODING = '1.9'.respond_to?(:force_encoding)
23
-
24
- def call(env)
25
- env[:request_headers][ACCEPT_ENCODING] ||= SUPPORTED_ENCODINGS
26
- @app.call(env).on_complete do |response_env|
27
- case response_env[:response_headers][CONTENT_ENCODING]
28
- when 'gzip'
29
- reset_body(response_env, &method(:uncompress_gzip))
30
- when 'deflate'
31
- reset_body(response_env, &method(:inflate))
32
- end
33
- end
34
- end
35
-
36
- def reset_body(env)
37
- env[:body] = yield(env[:body])
38
- env[:response_headers].delete(CONTENT_ENCODING)
39
- env[:response_headers][CONTENT_LENGTH] = env[:body].length
40
- end
41
-
42
- def uncompress_gzip(body)
43
- io = StringIO.new(body)
44
- gzip_reader = if RUBY_ENCODING
45
- Zlib::GzipReader.new(io, :encoding => 'ASCII-8BIT')
46
- else
47
- Zlib::GzipReader.new(io)
48
- end
49
- gzip_reader.read
50
- end
51
-
52
- def inflate(body)
53
- Zlib::Inflate.inflate(body)
54
- end
55
- end
56
- end