strongmind-platform-sdk 3.19.16 → 3.19.18

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
  SHA256:
3
- metadata.gz: 580fb42245c26f8134f0a716acc733c0d08aeecf6d54db9146ac2fe385e1fce8
4
- data.tar.gz: a9dc33df0401446d6887dc88686630b09be5d1fc14fb52e73576c1c17d5555c5
3
+ metadata.gz: 3d7fd18b069b57ab0fb2efb54241ac036fa8ae4359cbe9786e6362b961a79e87
4
+ data.tar.gz: 05d29502732ca0bd8653fa18789953d293129ac5b329d30b618618d14e02b3dd
5
5
  SHA512:
6
- metadata.gz: 140517212de5cb6fcd7cc63d477f9adf35d157a8a67cb872e223223f2ebcb3be536ef5d92c3f13746cfa5a480adad738afbe34ff605a7749b873577aad7f9934
7
- data.tar.gz: 4cd2ed5a724c4843c11817fbdc8acf5388e9b94ce0204e7c73b39078ca99544d64c345afe946a3ad54c7cb3acaeda531e616274a4e86b11acc64fe7b808e6288
6
+ metadata.gz: 7b37581856a7a5adcddf55ccc15ae4246086285de9e1ce976966167100edebcaaa686e74c5634388b0f6e4eae868523a1e3f8223e8ae76b64db18c26eaadd665
7
+ data.tar.gz: a1354e8332e57613673d78d624e44f3feb170ce746b54193e8a8b0067e52a6ac3556dedb8b4a85c4ed01aec290677b7e15956de68d4cf3728b70fc7f8b569fe2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.19.16)
4
+ strongmind-platform-sdk (3.19.18)
5
5
  activesupport (~> 7.1)
6
6
  aws-sdk-secretsmanager (~> 1.66)
7
7
  faraday (~> 2.5, >= 2.5.2)
@@ -95,7 +95,7 @@ GEM
95
95
  public_suffix (>= 2.0.2, < 6.0)
96
96
  ast (2.4.2)
97
97
  aws-eventstream (1.3.0)
98
- aws-partitions (1.941.0)
98
+ aws-partitions (1.944.0)
99
99
  aws-sdk-cloudwatch (1.92.0)
100
100
  aws-sdk-core (~> 3, >= 3.197.0)
101
101
  aws-sigv4 (~> 1.1)
@@ -104,7 +104,7 @@ GEM
104
104
  aws-partitions (~> 1, >= 1.651.0)
105
105
  aws-sigv4 (~> 1.8)
106
106
  jmespath (~> 1, >= 1.6.1)
107
- aws-sdk-secretsmanager (1.96.0)
107
+ aws-sdk-secretsmanager (1.98.0)
108
108
  aws-sdk-core (~> 3, >= 3.197.0)
109
109
  aws-sigv4 (~> 1.1)
110
110
  aws-sigv4 (1.8.0)
@@ -62,6 +62,12 @@ module PlatformSdk
62
62
  body = get(path)
63
63
  models::Domain.new(body)
64
64
  end
65
+
66
+ def domain_by_key(key)
67
+ path = "api/v1/domains?key=#{key}"
68
+ body = get(path)
69
+ models::Domain.new(body)
70
+ end
65
71
  end
66
72
  end
67
73
  end
@@ -64,9 +64,8 @@ module PlatformSdk
64
64
 
65
65
  def column_to_update(record)
66
66
  [:string, :integer, :boolean].each do |type|
67
- if record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.any?
68
- return record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.first.name
69
- end
67
+ columns_to_update = record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) && c.name != 'id' }
68
+ return columns_to_update.first.name if columns_to_update.any?
70
69
  end
71
70
  end
72
71
 
@@ -75,12 +74,12 @@ module PlatformSdk
75
74
 
76
75
  column_class = record[column]
77
76
  case column_class
78
- when String
79
- record.update!(column => new_record[column])
80
77
  when Integer
81
78
  record.update!(column => 69)
82
- when Boolean
79
+ when [true, false].include?(column_class)
83
80
  record.update!(column => !record[column])
81
+ else
82
+ record.update!(column => new_record[column])
84
83
  end
85
84
  end
86
85
  end
@@ -87,22 +87,23 @@ module PlatformSdk
87
87
  end
88
88
 
89
89
  def column_to_update(record)
90
- %i[string integer boolean].each do |type|
91
- if record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.any?
92
- return record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) }.first.name
93
- end
90
+ [:string, :integer, :boolean].each do |type|
91
+ columns_to_update = record.class.columns.select { |c| c.sql_type_metadata.type == type && !c.name.match?(/_type$/) && c.name != 'id' }
92
+ return columns_to_update.first.name if columns_to_update.any?
94
93
  end
95
94
  end
96
95
 
97
96
  def update_record(record, column)
97
+ new_record = build(described_class.to_s.underscore.to_sym)
98
+
98
99
  column_class = record[column]
99
100
  case column_class
100
- when String
101
- record.update!(column => "new value")
102
101
  when Integer
103
102
  record.update!(column => 69)
104
- when Boolean
103
+ when [true, false].include?(column_class)
105
104
  record.update!(column => !record[column])
105
+ else
106
+ record.update!(column => new_record[column])
106
107
  end
107
108
  end
108
109
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "3.19.16"
4
+ VERSION = "3.19.18"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.16
4
+ version: 3.19.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-07 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday