cacho 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/lib/cacho.rb +12 -5
  4. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 383e74d0ac66a216ed011020530efbc4570cce1e
4
- data.tar.gz: 84c5210831578a5f131a66535fce4d53b709e203
3
+ metadata.gz: f5ca8cc9f078ae86e02bc6afb967b4e63596cbc6
4
+ data.tar.gz: 2dfd696b59443bd1077ec5dd614838f057a4c526
5
5
  SHA512:
6
- metadata.gz: 9a447d7cf5f0dfeefa4e011409f54cfcf5b8f4d266855903002e578fde6d50165895f443da1be3acb280f4b3e4fc220d957e861f5c2336665e0b66bd40cb7bba
7
- data.tar.gz: 3b6a1da1d8299e79bc0aa2626548ca12ab847471afe914a58e2936f1fe9add41d4a8851327cf4a12c79e2bbedb44bc36566d472946570a3a18de407c469e1c37
6
+ metadata.gz: 8f83a5f46beaf4a85ae194143f0c34e7c682f42b7d27e1a89a4837fbe554499ca0458ac1d01a6aa50ce82ebfd43e9a8fe8b3e7c35e012e3a0cf902dda5fb1d76
7
+ data.tar.gz: 91be7e3b2db90c242bcdb54fd1788640c2d7a0d0130565a7cfac8aa2ad1d184b1909fb92c5608cc2483e7338b049bb35885e6eac9a29aa037fbc508b8973d3b0
@@ -0,0 +1,11 @@
1
+ 0.1.1 - 2014-11-02
2
+ ==================
3
+
4
+ * Use the `charset` directive in `Content-Type` if present.
5
+
6
+ * Ignore `Content-Type` when empty.
7
+
8
+ 0.1.0 - 2014-10-30
9
+ ==================
10
+
11
+ * First release.
@@ -7,7 +7,7 @@ require "csv"
7
7
  require "fileutils"
8
8
 
9
9
  class Cacho
10
- VERSION = "0.1.0"
10
+ VERSION = "0.1.1"
11
11
 
12
12
  attr_accessor :hasher
13
13
 
@@ -100,10 +100,17 @@ class Cacho::Client
100
100
  body = Zlib::GzipReader.new(StringIO.new(body)).read
101
101
  end
102
102
 
103
- if res["Content-Type"].start_with?("application/json")
104
- parsed = JSON.parse(body)
105
- else
106
- parsed = body
103
+ if res["Content-Type"]
104
+ if charset = res["Content-Type"][/\bcharset=(.+)\b/, 1]
105
+ body.force_encoding(charset)
106
+ body.encode!(Encoding.default_external)
107
+ end
108
+
109
+ if res["Content-Type"].start_with?("application/json")
110
+ parsed = JSON.parse(body)
111
+ else
112
+ parsed = body
113
+ end
107
114
  end
108
115
 
109
116
  if @callbacks[:rate_limit_detector]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cacho
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
  - Damian Janowski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-30 00:00:00.000000000 Z
12
+ date: 2014-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-http-persistent
@@ -34,6 +34,7 @@ extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
36
  - ".gitignore"
37
+ - CHANGELOG.md
37
38
  - README.md
38
39
  - Rakefile
39
40
  - UNLICENSE