trailer_vote-api 0.8.1 → 0.8.2

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: 0dec7c6d2ed054f4a4de949d17ed409a853f5b13
4
- data.tar.gz: c3ff5c5256e8864a2be2c1a2a117ad27bb932fde
3
+ metadata.gz: c36cbd2a3291e9d71f60f52856c3b2ccfbd39953
4
+ data.tar.gz: 454952b01ccb6acc926b4955da0069190462e836
5
5
  SHA512:
6
- metadata.gz: 948362c2f320ad48c44624f28058c2dc3824fdf73812b0ec1c1cef6164b314edc9ef0ac4780c44615ef5a134362487e7e98cfbefc1c8a45a27bf888e4046c05e
7
- data.tar.gz: 31d79b0516dc36264ca0f8ff595d81f32d2a654ee80a63a99aaab71c51cf427721a0cff665a3588eed04ba66f52d20e42e013ea8561fab42beacb23d55704c60
6
+ metadata.gz: 317ba976bffc5a1ff85254ea1babf3ec72517f83893ad76b23d32dc452bbb07cd373a40ae54937f41807113339fef487fb9cae9314f695649c662a8845924a19
7
+ data.tar.gz: a44bce3cf05ecf0492c547503b0ad732559940040efc35ff783fc27da31ebccf7379810b1b2a6a270f395c7d56e2f0eb59a6f9fc651acb5682e0c8643dba8a6f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.8.2
2
+
3
+ - Add a fallback if the `errors` is decoded correctly, but not the correct format.
4
+
1
5
  # 0.8.1
2
6
 
3
7
  - Add a fallback if the `errors` key does not exist for error messages
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trailer_vote-api (0.8.1)
4
+ trailer_vote-api (0.8.2)
5
5
  http (>= 3.3.0, < 4.x)
6
6
  oj (>= 3.6, < 4.x)
7
7
  trailer_vote-media_types (>= 0.6.1, < 1)
@@ -49,7 +49,7 @@ GEM
49
49
  json (>= 1.8, < 3)
50
50
  simplecov-html (~> 0.10.0)
51
51
  simplecov-html (0.10.2)
52
- trailer_vote-media_types (0.6.2)
52
+ trailer_vote-media_types (0.6.3)
53
53
  media_types (>= 0.6.0, < 1)
54
54
  unf (0.1.4)
55
55
  unf_ext
@@ -48,7 +48,7 @@ module TrailerVote
48
48
  end
49
49
 
50
50
  def messages
51
- Array(data[:errors]).map { |error| error[:message] }.join(', ')
51
+ Array(formatted_data[:errors]).map { |error| error[:message] }.join(', ')
52
52
  end
53
53
 
54
54
  def data
@@ -57,6 +57,13 @@ module TrailerVote
57
57
  # noinspection RubyStringKeysInHashInspection
58
58
  @data = { errors: [{ message: result.status.reason }] }
59
59
  end
60
+
61
+ private
62
+
63
+ def formatted_data
64
+ return data if data.is_a?(::Hash)
65
+ { errors: [{ message: String(data) }] }
66
+ end
60
67
  end
61
68
 
62
69
  class ClientError < ErrorsResponse; end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TrailerVote
4
4
  module Api
5
- VERSION = '0.8.1'
5
+ VERSION = '0.8.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailer_vote-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derk-Jan Karrenbeld