party_mixins 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b68b4a9679729da30b31a6fa7c7852d2a6118702d48c8a56aeb06c303aea341a
4
- data.tar.gz: a97e7d8d70d7c31f3d7c06924d9bb86ebd02a10511221c975ec2239e03d17556
3
+ metadata.gz: 77f410d5e8c91a83ee76a102a4d491585a1921878e57ef518b78be35a416bc1c
4
+ data.tar.gz: cd849b44f606444c6452f7bf29f3ab67bb70144afe2ca68922291ac289d5e6d7
5
5
  SHA512:
6
- metadata.gz: ca5df486768d32affc0db26c2ff98ad43fe14442921b3c33c9cd9dcbf27ac25abe7804ee21df35f282fbe5c50e8f8d9b782615b161dcff01887ef1c1e8889a99
7
- data.tar.gz: b296b23f6b84fbeb52a68b93f9049c54330401b79fabfa7f7e7590da0c3859394f28e99604e39b2b4039533e8e56a295bace4b8187f01e9c4718765484129188
6
+ metadata.gz: 8f8a4f0d4e3902e27ceb7c842c4b2ccc2551a40816806806335340e4188f8b53b91807a7177dcae8a160edbd264c72a03e70c29ef3c319baf0e9df0c0dde3ca8
7
+ data.tar.gz: d4e9c786b6220d1771f47b729384f1f21e07f1f51e0683d25071d9121cef22d4d714d1a598fe0b2037969d84bde363a796d70f359e921e15a21db869ab4dc2d8
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
+
8
+ ## [0.2.0] - 2021-01-16
9
+
10
+ ServiceError default message is now the response body
11
+
12
+ ### Added
13
+ - Initial version
7
14
 
8
15
  ## [0.1.0] - 2020-12-24
9
16
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- party_mixins (0.1.0)
4
+ party_mixins (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -59,6 +59,7 @@ GEM
59
59
  hashdiff (>= 0.4.0, < 2.0.0)
60
60
 
61
61
  PLATFORMS
62
+ x86_64-darwin-20
62
63
  x86_64-linux
63
64
 
64
65
  DEPENDENCIES
@@ -70,4 +71,4 @@ DEPENDENCIES
70
71
  webmock
71
72
 
72
73
  BUNDLED WITH
73
- 2.2.2
74
+ 2.2.4
@@ -19,6 +19,12 @@ module PartyMixins
19
19
  @party_methods ||= {}
20
20
  end
21
21
 
22
+ def build_options(method_name, response)
23
+ {
24
+ error_message: response.body
25
+ }.merge(party_methods[method_name])
26
+ end
27
+
22
28
  private
23
29
 
24
30
  def method_added(method_name)
@@ -31,10 +37,11 @@ module PartyMixins
31
37
  end
32
38
 
33
39
  def enhance!(method_name)
34
- options = build_options(method_name)
40
+ this = self
35
41
  proxy = Module.new do
36
42
  define_method(method_name) do |*args|
37
43
  response = super(*args)
44
+ options = this.build_options(method_name, response)
38
45
  raise ServiceError.new(response, options[:error_message]) unless response.ok?
39
46
 
40
47
  response.parsed_response
@@ -42,11 +49,5 @@ module PartyMixins
42
49
  end
43
50
  prepend proxy
44
51
  end
45
-
46
- def build_options(method_name)
47
- {
48
- error_message: "Service responded with an error"
49
- }.merge(party_methods[method_name])
50
- end
51
52
  end
52
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PartyMixins
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: party_mixins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Humberto Guerrero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-24 00:00:00.000000000 Z
11
+ date: 2021-01-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: HTTParty mixin extension
14
14
  email: