bima-shark-sdk 2.4.0 → 2.4.2

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
  SHA1:
3
- metadata.gz: 5cd9e83af8c7d48a3ca87715aa3743e6195a3e85
4
- data.tar.gz: 2fe2155fa9f5e1619791a6c988b7d77aaa22a61d
3
+ metadata.gz: a940bf61424a49baa7f04791ca42ba61bb145a97
4
+ data.tar.gz: 734da4e58e55397a983e31ac9e53aa372e664a7b
5
5
  SHA512:
6
- metadata.gz: 96753859d7e2363bbadab88a43699da4c953c62289e2121a42486997aa35d5558496affc6ef478e94699df38c5508c0eac195e0d54641d92c4886a50ffd15d39
7
- data.tar.gz: 309c64b4042225ef5f345bd48fbc573a0fb9daeaaf74f411b7994622786dbd3d93dfa0097ce1d4e32125da146f32b8385f3ccb9ce218efaefa9f2c92afb0dcb8
6
+ metadata.gz: 7c1ade4eaefb81ae08c8e799d29bd6caf4b4ff1f355df7f4382c9bd0cddb3dcc0b3b0022fb4c68ffeb6d3278a95cca50a04b3076002ff1d1e5a5e9688881b36a
7
+ data.tar.gz: 12186155c320e2254eed1d4e4dcfe47ac31b2f540e5d5470d15472c3b333d9915fc75347795762be86438c7d556e004d85d2f02235bd89d5913e32f62709d763
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ## Changelog
2
2
 
3
- #### Unreleased
3
+ #### 2.4.2
4
+ - [fix] don't swallow connection errors
5
+
6
+ #### 2.4.1
7
+ - [fix] Form Service: Added missing `versions` association to `Form`
4
8
 
5
9
  #### 2.4.0
6
10
  - added `Shark::Contact#consents` and `Shark::Contact#create_contract`
data/lib/shark/error.rb CHANGED
@@ -24,11 +24,7 @@ module Shark
24
24
  end
25
25
  end
26
26
 
27
- class ConnectionError < ApiError
28
- def initialize(env)
29
- @env = env
30
- end
31
- end
27
+ class ConnectionError < Error; end
32
28
 
33
29
  class ClientError < ApiError; end
34
30
 
@@ -4,6 +4,8 @@ module Shark
4
4
  module FormService
5
5
  module V2
6
6
  class Form < V2::Base
7
+ has_many :versions
8
+
7
9
  # @example
8
10
  # form = Shark::FormService::V2::Form.find(id)
9
11
  # form.activate
@@ -12,8 +12,8 @@ module Shark
12
12
  handle_status(status, env)
13
13
  end
14
14
  end
15
- rescue Faraday::ConnectionFailed, Faraday::TimeoutError
16
- raise ConnectionError, environment
15
+ rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e
16
+ raise ConnectionError, e
17
17
  end
18
18
 
19
19
  private
@@ -32,7 +32,7 @@ module Shark
32
32
  log_info '[Shark][ContactService] Faking GET request'
33
33
  log_info request.uri.to_s
34
34
 
35
- type = request.uri.path.split('/')[2]
35
+ type = request.uri.path.split('/')[-1]
36
36
  params = query_params_to_object(request.uri)
37
37
 
38
38
  objects = if %w[contacts accounts].include?(type) && params['filter'].present?
@@ -52,8 +52,8 @@ module Shark
52
52
  log_info '[Shark][ContactService] Faking GET request with ID'
53
53
  log_info request.uri.to_s
54
54
 
55
- type = request.uri.path.split('/')[2]
56
- id = request.uri.path.split('/')[3]
55
+ type = request.uri.path.split('/')[-2]
56
+ id = request.uri.path.split('/')[-1]
57
57
  query = request.uri.query_values
58
58
 
59
59
  object = cache.find(type, id)
@@ -84,11 +84,10 @@ module Shark
84
84
  log_info '[Shark][ContactService] Faking GET memberships request'
85
85
  log_info request.uri.to_s
86
86
 
87
- type = request.uri.path.split('/')[2]
88
- group_id = request.uri.path.split('/')[3]
87
+ group_id = request.uri.path.split('/')[-2]
89
88
  contact_id = query_params_to_object(request.uri)['filter']['contact_id']
90
89
 
91
- group = cache.find(type, group_id)
90
+ group = cache.find('groups', group_id)
92
91
 
93
92
  if group.present?
94
93
  contacts = group.dig('relationships', 'contacts', 'data')
@@ -107,8 +106,8 @@ module Shark
107
106
  log_info "[Shark][ContactService] Faking PATCH request with body: #{request.body}"
108
107
  log_info request.uri.to_s
109
108
 
110
- type = request.uri.path.split('/')[2]
111
- id = request.uri.path.split('/')[3]
109
+ type = request.uri.path.split('/')[-2]
110
+ id = request.uri.path.split('/')[-1]
112
111
  parsed_data = JSON.parse(request.body)['data']
113
112
 
114
113
  object = cache.find(type, id)
@@ -134,8 +133,8 @@ module Shark
134
133
  log_info '[Shark][ContactService] Faking DELETE request'
135
134
  log_info request.uri.to_s
136
135
 
137
- type = request.uri.path.split('/')[2]
138
- id = request.uri.path.split('/')[3]
136
+ type = request.uri.path.split('/')[-2]
137
+ id = request.uri.path.split('/')[-1]
139
138
 
140
139
  object = cache.find(type, id)
141
140
 
data/lib/shark/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shark
4
- VERSION = '2.4.0'
4
+ VERSION = '2.4.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bima-shark-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huy Dinh
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-01-10 00:00:00.000000000 Z
13
+ date: 2022-10-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport