party_mixins 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +3 -2
- data/lib/party_mixins.rb +8 -7
- data/lib/party_mixins/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: 77f410d5e8c91a83ee76a102a4d491585a1921878e57ef518b78be35a416bc1c
|
4
|
+
data.tar.gz: cd849b44f606444c6452f7bf29f3ab67bb70144afe2ca68922291ac289d5e6d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f8a4f0d4e3902e27ceb7c842c4b2ccc2551a40816806806335340e4188f8b53b91807a7177dcae8a160edbd264c72a03e70c29ef3c319baf0e9df0c0dde3ca8
|
7
|
+
data.tar.gz: d4e9c786b6220d1771f47b729384f1f21e07f1f51e0683d25071d9121cef22d4d714d1a598fe0b2037969d84bde363a796d70f359e921e15a21db869ab4dc2d8
|
data/CHANGELOG.md
CHANGED
@@ -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
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
party_mixins (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.
|
74
|
+
2.2.4
|
data/lib/party_mixins.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/party_mixins/version.rb
CHANGED
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.
|
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:
|
11
|
+
date: 2021-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: HTTParty mixin extension
|
14
14
|
email:
|