eps-rapid 1.1.0 → 1.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 +9 -0
- data/README.md +1 -1
- data/lib/eps-rapid/client.rb +12 -4
- data/lib/eps-rapid/errors/http_status_codes.rb +1 -0
- data/lib/eps-rapid/version.rb +1 -1
- data/lib/eps-rapid.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0635d7fc795915ac4229d1968713e1f78ab615ec52bd59cb9a3fce51b421ce20
|
4
|
+
data.tar.gz: fb3aab1e962108feea5d465907fd680d5c312589b1a73b143d1e61be752d4129
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f7056cc0acbedbe619bdd81c4c0120d2866c6f9940b098417eeb40238a01505d0d9e34978d6e920db583dbbb5ee7cac6075e1b49ccb886f1eeefe7442542191
|
7
|
+
data.tar.gz: 9daa91af2bd45fdf330aa182a12da06c981114f5420b8ab3dcd603a16d6c3d42d1aac63b931389c39b2d1d71a17887f70e901cf0bdf3e35742e4f4cfe7294110
|
data/CHANGELOG.MD
CHANGED
@@ -25,3 +25,12 @@
|
|
25
25
|
# Added
|
26
26
|
- add request and response logging
|
27
27
|
- 204 responses returns hash
|
28
|
+
### Version 1.1.1
|
29
|
+
# Patched
|
30
|
+
- support for multi-value params, i.e. `property_id: [1234, 2345]` is translated to `property_id=1234&property_id=2345`
|
31
|
+
### Version 1.1.3
|
32
|
+
# Patched
|
33
|
+
- support 202 response
|
34
|
+
### Version 1.2.0
|
35
|
+
# Changed
|
36
|
+
- configuration: language -> language_resolver
|
data/README.md
CHANGED
data/lib/eps-rapid/client.rb
CHANGED
@@ -46,7 +46,7 @@ module EpsRapid
|
|
46
46
|
|
47
47
|
def generate_uri(path, params)
|
48
48
|
uri = URI("#{EpsRapid.base_path}/#{path}")
|
49
|
-
params.merge!({ language:
|
49
|
+
params.merge!({ language: language })
|
50
50
|
transformed_params = transform_params(params)
|
51
51
|
transformed_params.reject { |k,_| k == :customer_ip }
|
52
52
|
uri.query = URI.encode_www_form(transformed_params) unless path.include?('token')
|
@@ -54,13 +54,19 @@ module EpsRapid
|
|
54
54
|
uri
|
55
55
|
end
|
56
56
|
|
57
|
+
def language
|
58
|
+
EpsRapid.language_resolver.call
|
59
|
+
end
|
60
|
+
|
57
61
|
def transform_params(params)
|
58
62
|
params.each do |k, v|
|
59
63
|
params[k] =
|
60
64
|
if k == :occupancy
|
61
65
|
v.to_s.tr(' ', '').split(';')
|
62
|
-
|
66
|
+
elsif v.is_a?(String) || v.is_a?(Symbol) || v.is_a?(Integer)
|
63
67
|
v.to_s.tr(' ', '').split(',')
|
68
|
+
else
|
69
|
+
v
|
64
70
|
end
|
65
71
|
end
|
66
72
|
end
|
@@ -79,13 +85,15 @@ module EpsRapid
|
|
79
85
|
req['Customer-Ip'] = customer_ip if customer_ip != ''
|
80
86
|
req['Test'] = test_header if test_header != ''
|
81
87
|
|
82
|
-
logger.debug("Request: #{uri.
|
88
|
+
logger.debug("Request: #{uri} headers=(#{req.to_hash}): body=(#{req.body})")
|
83
89
|
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
|
84
|
-
logger.debug("Response: #{response.code.to_i}: #{response.body}")
|
90
|
+
logger.debug("Response: #{response.code.to_i} headers=(#{response.to_hash}): body=(#{response.body})")
|
85
91
|
|
86
92
|
case response.code.to_i
|
87
93
|
when HttpStatusCodes::HTTP_OK_CODE, HttpStatusCodes::HTTP_CREATED_CODE
|
88
94
|
JSON.parse(response.body)
|
95
|
+
when HttpStatusCodes::HTTP_ACCEPTED_CODE
|
96
|
+
{ 'status' => 202 }
|
89
97
|
when HttpStatusCodes::HTTP_NO_CONTENT_CODE
|
90
98
|
{ 'status' => 204 }
|
91
99
|
else
|
data/lib/eps-rapid/version.rb
CHANGED
data/lib/eps-rapid.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eps-rapid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Leonenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
|
-
rubygems_version: 3.2.
|
94
|
+
rubygems_version: 3.2.22
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Ruby wrapper for the expediapartnersolutions.com api
|