vehicles 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02e8cd34e8d4383e6c5859d20ca3aa735d55f6829ff062a7bd48b482b417f4b2
4
- data.tar.gz: 26c5f4d78dd4e01c38d9d5b2a85319da52b910091deffc4d54ec4f29e510cafd
3
+ metadata.gz: 5972a6647d3cfa0383634d95002c4aae94d405bc00d6354e4cc0d5a7bd57901e
4
+ data.tar.gz: b06cfd87bdc9b80466296b1cc7e7492bcb4f4a45610dd9c0c3e777e16278ee89
5
5
  SHA512:
6
- metadata.gz: 86fb03f91835b6449bd8becd1719fb01c84c51ec7822e9d567660f28ef35ccf867cffb688e7200dc50d7702cdeb401e0cc3550ca12059b6815ceded826fd339b
7
- data.tar.gz: 4b732abbcb7e038457996a1e0633200c5ec57be5f1486d40a01f48f01f5b93ad3712d075e9d7c4b56e5cd19567f76313939a70630e0fbeeaa400718849dbbbe4
6
+ metadata.gz: 507c5b6ee9f310969f9efa78d617e3676165bf6153cc8acf13786409bcaf76459607778609019c684aba48dbc8c37b57b16996c7b512409adf2af699b38098d8
7
+ data.tar.gz: 873795cf18b656ab8936c7412b3249e73200a25f3a976849b9ef16f278ac58952cd6ec83111099b4f5ed56c68bafccb6b24aca23c84ee62510f38705d31e9be9
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.1] - 2026-06-23
11
+
12
+ ### Fixed
13
+ - **Data refresh** now handles real HTTP responses correctly. `Net::HTTP` returns
14
+ an ASCII-8BIT body (e.g. gzip-decompressed); with multibyte UTF-8 data and
15
+ `Encoding.default_internal = UTF-8` (as Rails sets), the cache write raised
16
+ `Encoding::UndefinedConversionError` and the refresh silently failed (falling
17
+ back to the bundled snapshot). The fetched body is now tagged UTF-8 and the
18
+ cache is written with `File.binwrite` (no transcoding). `Vehicles.refresh!`
19
+ works under Rails.
20
+
10
21
  ## [0.1.0] - 2026-06-23
11
22
 
12
23
  Initial release.
@@ -75,7 +75,10 @@ module Vehicles
75
75
  response = http.get(uri.request_uri, "Accept" => "application/json")
76
76
  case response
77
77
  when Net::HTTPSuccess
78
- response.body
78
+ # Net::HTTP hands back an ASCII-8BIT body (e.g. after gzip decompression);
79
+ # our datasets are UTF-8 JSON, so label it correctly. Otherwise downstream
80
+ # writes/parses can transcode-raise under Encoding.default_internal = UTF-8.
81
+ response.body&.dup&.force_encoding(Encoding::UTF_8)
79
82
  when Net::HTTPRedirection
80
83
  return nil if redirects_left <= 0
81
84
 
@@ -87,7 +90,9 @@ module Vehicles
87
90
  require "fileutils"
88
91
  FileUtils.mkdir_p(File.dirname(path))
89
92
  tmp = "#{path}.#{Process.pid}.tmp"
90
- File.write(tmp, body)
93
+ # Binary write: persist the exact bytes, never transcode. Robust regardless
94
+ # of the body's encoding or the app's Encoding.default_internal.
95
+ File.binwrite(tmp, body)
91
96
  File.rename(tmp, path) # atomic on the same filesystem
92
97
  end
93
98
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vehicles
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vehicles
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
  - rameerez