seam 2.3.0 → 2.3.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
  SHA256:
3
- metadata.gz: 9005bf668cb6e7c1d6b04eeccc9a823c2fee4c2694684058eda15def98c98739
4
- data.tar.gz: 0ffae640e0e2c70f417cb86519459519aac33bc907c1f9d0e7cf56e5329bc9ce
3
+ metadata.gz: 8021a5c173122f3b94f93794cc375a3119af2237acc6d49fd4290a795eda9861
4
+ data.tar.gz: 9abfaf6963d9fec7f764f9a7c644107d3b1bb8321bb47a861034f227037623f4
5
5
  SHA512:
6
- metadata.gz: 1825424173e17c9175df0485a853acb80253b9787db538e944b0aa0d00b774c0ad0595656b45d886f7f664131a44996a5d59b76fd6d5051a62d1e1c355f0eaa4
7
- data.tar.gz: 370712cee91cbeb94c97a715cf4a164079994f4608c707ef7422205dd3f437fa212e7426f0a064add7a4bb2718706798e8ec4caf5192a009d35141c37f2d012e
6
+ metadata.gz: 026f63d334ec08141c03e767dbf83acb7c13683371bcbfd7d11d85a7949e49e751b5513df761fc3dda93f42a2624ffa71f2d8fa531acc5322cd839b8c39fcd0d
7
+ data.tar.gz: c6b4b366bf2dd2c016b1d221364edff29b63f476de8030cad9af3902a743607549f6a481f281d5dcc41fde706cedd69c790cbe0292e2219e5d9489b05e21b2c6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seam (2.3.0)
4
+ seam (2.3.2)
5
5
  faraday (~> 2.7)
6
6
  faraday-retry (~> 2.2)
7
7
  svix (~> 1.30)
@@ -11,19 +11,12 @@ module Seam
11
11
  def initialize(data, client = nil)
12
12
  @data = data
13
13
  @client = client
14
-
15
- @data.each do |key, value|
16
- value = Seam::DeepHashAccessor.new(value) if value.is_a?(Hash)
17
- instance_variable_set(:"@#{key}", value)
18
- end
14
+ process_data_attributes(@data)
19
15
  end
20
16
 
21
17
  def update_from_response(data)
22
18
  @data = data
23
- @data.each do |key, value|
24
- value = Seam::DeepHashAccessor.new(value) if value.is_a?(Hash)
25
- instance_variable_set(:"@#{key}", value)
26
- end
19
+ process_data_attributes(@data)
27
20
  end
28
21
 
29
22
  def self.load_from_response(data, client = nil)
@@ -48,9 +41,7 @@ module Seam
48
41
  define_method(attr) do
49
42
  value = instance_variable_get(:"@#{attr}")
50
43
 
51
- raise "No value for #{attr} set" if value.nil?
52
-
53
- parse_datetime(value)
44
+ value.nil? ? nil : parse_datetime(value)
54
45
  end
55
46
  end
56
47
  end
@@ -60,6 +51,21 @@ module Seam
60
51
  def parse_datetime(value)
61
52
  Time.parse(value)
62
53
  end
54
+
55
+ def process_data_attributes(data)
56
+ data.each do |key, value|
57
+ value = process_hash_value(value)
58
+ instance_variable_set(:"@#{key}", value)
59
+ end
60
+ end
61
+
62
+ def process_hash_value(value)
63
+ if value.is_a?(Hash) && !value.empty?
64
+ Seam::DeepHashAccessor.new(value)
65
+ else
66
+ value
67
+ end
68
+ end
63
69
  end
64
70
  end
65
71
  end
data/lib/seam/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Seam
4
- VERSION = "2.3.0"
4
+ VERSION = "2.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seam
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seam Labs, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-22 00:00:00.000000000 Z
11
+ date: 2024-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday