eps-rapid 1.0.1 → 1.1.0

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
  SHA256:
3
- metadata.gz: fd6b9fdb7c19bea18884ea30df65b97ed84880d783424dd10bf6c6cf60480a93
4
- data.tar.gz: daf9a328813667def4c5d0cac9ab990bf03e7aa65256334e4c7c93c675b44868
3
+ metadata.gz: dcd0be2a6d1af3b238c2ec17798b45c5ad65d8ef70bdb191fcad9d18981646ae
4
+ data.tar.gz: 509b3b7ddda1704f4ef624319caa554cf5cfc764d2863502447d62515509a216
5
5
  SHA512:
6
- metadata.gz: 7700ad552e2d7e7c78ead9eac6899c4f933992338c9ea9e6bfda538b493dfc1bfd6fd0e9b09e33493612fd9e45d5eeb921b6c68d2cba11141b322ad74b260305
7
- data.tar.gz: f253d0b98ab386f050fe2f6ee99db82c06b567020584745d6146d71d3541a10e28bf7a02cba0c796938a4011ac3587cfac28e625a37d6afe39318071d8a350fb
6
+ metadata.gz: 6b687c4e03a0e12afd35605d2ab68c106acd5ffa5271a3f20c0ddf05bd7e9a1b4c1f1d9a06e1fe8c8751f87dd076a254715b12af3274940b5f43926c645e661e
7
+ data.tar.gz: 48c5da42c39b792eaba211f574bac1d73a8ed1c318885fe37ba56ab1559897ddf6d5b85b1f3ed967dc0dd55bfbd5b2d3e10ea5e959aeb8791b7dd954fa849b51
data/CHANGELOG.MD CHANGED
@@ -21,3 +21,7 @@
21
21
  ### Version 1.0.1
22
22
  # Changed
23
23
  - add compatibility with ruby 3.0.0
24
+ ### Version 1.1.0
25
+ # Added
26
+ - add request and response logging
27
+ - 204 responses returns hash
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # eps-rapid
2
- Ruby gem for the eps-rapid 2.4 API
2
+ Ruby gem for the eps-rapid 2.4 and 3 API
3
3
 
4
4
  ## Installation
5
5
 
@@ -20,6 +20,7 @@ EpsRapid.configure do |c|
20
20
  c.secret_key = 'YOUR_SECRET_KEY'
21
21
  c.base_path = 'BASE_PATH'
22
22
  c.language = 'en-US'
23
+ c.logger = Logger.new(nil)
23
24
  end
24
25
  ```
25
26
  Base path depends of environment and can be `https://test.ean.com/2.4` or `https://api.ean.com/2.4`
@@ -79,13 +79,15 @@ module EpsRapid
79
79
  req['Customer-Ip'] = customer_ip if customer_ip != ''
80
80
  req['Test'] = test_header if test_header != ''
81
81
 
82
+ logger.debug("Request: #{uri.to_s}: #{req.body}")
82
83
  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}")
83
85
 
84
86
  case response.code.to_i
85
87
  when HttpStatusCodes::HTTP_OK_CODE, HttpStatusCodes::HTTP_CREATED_CODE
86
88
  JSON.parse(response.body)
87
89
  when HttpStatusCodes::HTTP_NO_CONTENT_CODE
88
- 'Code: 204, No content'
90
+ { 'status' => 204 }
89
91
  else
90
92
  raise error_class(response.code), "Code: #{response.code}, Error: #{map_error_messages(response.body)}"
91
93
  end
@@ -125,6 +127,10 @@ module EpsRapid
125
127
  parsed_errors['message']
126
128
  end
127
129
  end
130
+
131
+ def logger
132
+ EpsRapid.logger || Logger.new(nil)
133
+ end
128
134
  end
129
135
  end
130
136
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EpsRapid
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.0'
5
5
  end
data/lib/eps-rapid.rb CHANGED
@@ -12,10 +12,11 @@ require 'eps-rapid/manage_booking'
12
12
  require 'eps-rapid/recommendations'
13
13
  require 'eps-rapid/notifications'
14
14
  require 'digest'
15
+ require 'logger'
15
16
 
16
17
  module EpsRapid
17
18
  class << self
18
- attr_accessor :api_key, :secret_key, :base_path, :language
19
+ attr_accessor :api_key, :secret_key, :base_path, :language, :logger
19
20
 
20
21
  def configure
21
22
  yield(self)
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.0.1
4
+ version: 1.1.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: 2021-06-01 00:00:00.000000000 Z
11
+ date: 2021-11-16 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.0.3
94
+ rubygems_version: 3.2.3
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Ruby wrapper for the expediapartnersolutions.com api