resizing 0.5.3 → 0.6.0
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 +10 -2
- data/lib/resizing.rb +3 -1
- data/lib/resizing/client.rb +25 -3
- data/lib/resizing/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2bdfaa73ba0bd1216d010dad515e8b23fe160b5b43d86501df1a53c76817798
|
4
|
+
data.tar.gz: 7f2360c0077fa45befefe90e2279190729314536022698793547747895619634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aac8436eaf6bd4471d5dc3d5474dc4d3b8c75cf30c52bb7ed496ca57cdd3e6994847bafb9b95258f5baf2863114bd178ba81a5e3863123ea147cad8c7f3ad20
|
7
|
+
data.tar.gz: 82ba5efdd89fb3b3d5927a3470dc65541faefe1d0b5adf8498b642e9ecc893775c6a0f67cb0fde0be0f36be42f06217bfab2646442d568d3b548957d8d36e4b2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.5.3](https://github.com/jksy/resizing-gem/tree/v0.5.3) (2020-10-15)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/jksy/resizing-gem/compare/v0.5.2...v0.5.3)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Feature/fix raise error [\#40](https://github.com/jksy/resizing-gem/pull/40) ([jksy](https://github.com/jksy))
|
10
|
+
|
3
11
|
## [v0.5.2](https://github.com/jksy/resizing-gem/tree/v0.5.2) (2020-10-11)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/jksy/resizing-gem/compare/v0.5.1...v0.5.2)
|
@@ -114,7 +122,7 @@
|
|
114
122
|
**Merged pull requests:**
|
115
123
|
|
116
124
|
- Feature/fix raise error [\#16](https://github.com/jksy/resizing-gem/pull/16) ([jksy](https://github.com/jksy))
|
117
|
-
-
|
125
|
+
- change mysql port on docker-compose [\#9](https://github.com/jksy/resizing-gem/pull/9) ([jksy](https://github.com/jksy))
|
118
126
|
|
119
127
|
## [v0.1.0](https://github.com/jksy/resizing-gem/tree/v0.1.0) (2020-06-07)
|
120
128
|
|
@@ -126,7 +134,7 @@
|
|
126
134
|
- Feature/add test test for remove xxx [\#13](https://github.com/jksy/resizing-gem/pull/13) ([jksy](https://github.com/jksy))
|
127
135
|
- add rubocop & fix some tests [\#12](https://github.com/jksy/resizing-gem/pull/12) ([jksy](https://github.com/jksy))
|
128
136
|
- fix the column cant be update by null value [\#11](https://github.com/jksy/resizing-gem/pull/11) ([jksy](https://github.com/jksy))
|
129
|
-
-
|
137
|
+
- fix empty url when model is reload [\#10](https://github.com/jksy/resizing-gem/pull/10) ([jksy](https://github.com/jksy))
|
130
138
|
- fix return invalid url when model is reloaded [\#8](https://github.com/jksy/resizing-gem/pull/8) ([jksy](https://github.com/jksy))
|
131
139
|
- add circleci [\#7](https://github.com/jksy/resizing-gem/pull/7) ([jksy](https://github.com/jksy))
|
132
140
|
- divide some classes and add tests [\#6](https://github.com/jksy/resizing-gem/pull/6) ([jksy](https://github.com/jksy))
|
data/lib/resizing.rb
CHANGED
@@ -13,7 +13,9 @@ module Resizing
|
|
13
13
|
|
14
14
|
class Error < StandardError; end
|
15
15
|
class ConfigurationError < Error; end
|
16
|
-
class APIError < Error;
|
16
|
+
class APIError < Error;
|
17
|
+
attr_accessor :decoded_body
|
18
|
+
end
|
17
19
|
|
18
20
|
def self.configure
|
19
21
|
raise ConfigurationError, 'Resizing.configure is not initialized' unless defined? @configure
|
data/lib/resizing/client.rb
CHANGED
@@ -63,6 +63,8 @@ module Resizing
|
|
63
63
|
|
64
64
|
result = handle_create_response(response)
|
65
65
|
result
|
66
|
+
rescue Faraday::TimeoutError => e
|
67
|
+
handle_timeout_error e
|
66
68
|
end
|
67
69
|
|
68
70
|
def put(image_id, file_or_binary, options)
|
@@ -83,6 +85,8 @@ module Resizing
|
|
83
85
|
|
84
86
|
result = handle_create_response(response)
|
85
87
|
result
|
88
|
+
rescue Faraday::TimeoutError => e
|
89
|
+
handle_timeout_error e
|
86
90
|
end
|
87
91
|
|
88
92
|
def delete(image_id)
|
@@ -94,6 +98,8 @@ module Resizing
|
|
94
98
|
|
95
99
|
result = handle_delete_response(response)
|
96
100
|
result
|
101
|
+
rescue Faraday::TimeoutError => e
|
102
|
+
handle_timeout_error e
|
97
103
|
end
|
98
104
|
|
99
105
|
def metadata(image_id, options = {})
|
@@ -105,6 +111,8 @@ module Resizing
|
|
105
111
|
|
106
112
|
result = handle_metadata_response(response)
|
107
113
|
result
|
114
|
+
rescue Faraday::TimeoutError => e
|
115
|
+
handle_timeout_error e
|
108
116
|
end
|
109
117
|
|
110
118
|
private
|
@@ -166,7 +174,10 @@ module Resizing
|
|
166
174
|
when HTTP_STATUS_OK, HTTP_STATUS_CREATED
|
167
175
|
JSON.parse(response.body)
|
168
176
|
else
|
169
|
-
|
177
|
+
result = JSON.parse(response.body) rescue {}
|
178
|
+
err = APIError.new("invalid http status code #{response.status}")
|
179
|
+
err.decoded_body = result
|
180
|
+
raise err
|
170
181
|
end
|
171
182
|
end
|
172
183
|
|
@@ -177,7 +188,10 @@ module Resizing
|
|
177
188
|
when HTTP_STATUS_OK, HTTP_STATUS_NOT_FOUND
|
178
189
|
JSON.parse(response.body)
|
179
190
|
else
|
180
|
-
|
191
|
+
result = JSON.parse(response.body) rescue {}
|
192
|
+
err = APIError.new("invalid http status code #{response.status}")
|
193
|
+
err.decoded_body = result
|
194
|
+
raise err
|
181
195
|
end
|
182
196
|
end
|
183
197
|
|
@@ -188,8 +202,16 @@ module Resizing
|
|
188
202
|
when HTTP_STATUS_OK, HTTP_STATUS_NOT_FOUND
|
189
203
|
JSON.parse(response.body)
|
190
204
|
else
|
191
|
-
|
205
|
+
result = JSON.parse(response.body) rescue {}
|
206
|
+
err = APIError.new("invalid http status code #{response.status}")
|
207
|
+
err.decoded_body = result
|
208
|
+
raise err
|
192
209
|
end
|
193
210
|
end
|
211
|
+
|
212
|
+
def handle_timeout_error error
|
213
|
+
# error: Faraday::TimeoutError
|
214
|
+
raise APIError.new("TimeoutError: #{error.inspect}")
|
215
|
+
end
|
194
216
|
end
|
195
217
|
end
|
data/lib/resizing/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resizing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Junichiro Kasuya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|