artirix_data_models 0.26.0 → 0.27.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
  SHA1:
3
- metadata.gz: 2efa847dc8cfed6755c5717fa582157d2c76a197
4
- data.tar.gz: 29a9c8eae07e6e058f898e9790d749bdd1c87f62
3
+ metadata.gz: 3f9cd1a03f99dc1e1c65f5da959e6a524f5b1c29
4
+ data.tar.gz: 45204802a7e2a927035eb374c2b2e03b3c2bbf00
5
5
  SHA512:
6
- metadata.gz: 72f11738fa0f75510486170c79db846b15257572943b0a22e928b41e1eeea36eb3bbe31fed93e03223645567f2b23e1b98b9bc8404c7e8be081e053b340e72ec
7
- data.tar.gz: 3ecbdc482c1f817af74808b103202d80029b3c4803b7f87df6a304f43875fab21ef9ff66aa3b7fd90e0c526b08da0071892a00b35bb6dc74fe4c78cd84ac4837
6
+ metadata.gz: 4b83155af3a24841fd99e5e57f2540d419a3bc66ddec372c5cfa0f84863eb3f9a0d44465a5b745cb21802036256978f6d7023e9ac226e7f8457fe4d078bef61f
7
+ data.tar.gz: 314ddf060bd85630e896c1e86aaac76a0087f73ea84dc4ed6cb86e8f89206ce094fe80b6e60e110e11daea3926e12173f32b1c1edca023c88b59d585faa5cf63
data/README.md CHANGED
@@ -327,6 +327,9 @@ end
327
327
 
328
328
  ## Changes
329
329
 
330
+ ### 0.27.0
331
+ - Add settings to log requests and responses bodies: `log_body_request` and `log_body_response`. Added to the `DataGateway::ConectionLoader#connection` method, and to the same config that stores ```login``` and ```password``` settings.
332
+
330
333
  ### 0.26.0
331
334
  - Expose cache configuration in case the app has config specific for `artirix_cache_service` that we want to use with `ArtirixDataModels.use_cache_service(artirix_cache_service)` where the argument is a `ArtirixCacheService::Service` object.
332
335
 
@@ -258,18 +258,21 @@ class ArtirixDataModels::DataGateway
258
258
  connection config: ArtirixDataModels.configuration.send(config_key), **others
259
259
  end
260
260
 
261
- def connection(config: {}, url: nil, login: nil, password: nil, bearer_token: nil, token_hash: nil)
262
- url ||= config.try :url
263
- login ||= config.try :login
264
- password ||= config.try :password
265
- bearer_token ||= config.try :bearer_token
266
- token_hash ||= config.try :token_hash
261
+ def connection(config: {}, url: nil, login: nil, password: nil, bearer_token: nil, token_hash: nil, log_body_request: nil, log_body_response: nil)
262
+ url ||= config.try :url
263
+ login ||= config.try :login
264
+ password ||= config.try :password
265
+ bearer_token ||= config.try :bearer_token
266
+ token_hash ||= config.try :token_hash
267
+ log_body_request ||= log_body_request.nil? ? config.try(:log_body_request) : log_body_request
268
+ log_body_response ||= log_body_response.nil? ? config.try(:log_body_response) : log_body_response
267
269
 
268
270
  raise InvalidConnectionError, 'no url given, nor is it present in `config.url`' unless url.present?
269
271
 
270
272
  Faraday.new(url: url, request: { params_encoder: Faraday::FlatParamsEncoder }) do |faraday|
271
273
  faraday.request :url_encoded # form-encode POST params
272
- faraday.response :logger # log requests to STDOUT
274
+ # faraday.response :logger # log requests to STDOUT
275
+ faraday.response :logger, ::Logger.new(STDOUT), bodies: { request: log_body_request, response: log_body_response }
273
276
 
274
277
  if login.present? || password.present?
275
278
  faraday.basic_auth(login, password)
@@ -1,3 +1,3 @@
1
1
  module ArtirixDataModels
2
- VERSION = '0.26.0'
2
+ VERSION = '0.27.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artirix_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Turiño
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-20 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport