ding_sdk 0.7.2 → 0.7.4

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: ceaa45f2c91546cf4e227b467cc200290dbaacaab55004d46e9763c88a1b8b44
4
- data.tar.gz: '096cc493127b4b61e3a08aa13bd397a40e33bb08019da5462b6b67f7732e0453'
3
+ metadata.gz: b12ff403f0d6e4b62773c740528c3da60f938e3118355db1b6e6d9d9a3d8289b
4
+ data.tar.gz: 97f847aa40d469b426e64f84253a94ba20a8a26050473df0e11a64dc48f7d560
5
5
  SHA512:
6
- metadata.gz: 2c1f6f46131799648cd28df0400064fa1eb5cfeb0baf4553ea17dc92b70d096d5bb7e21030a3d31f769a7e6b2280c94d57904b29f235a8ea9a3366e22cd51609
7
- data.tar.gz: b13c09e42f2cd5582d228111ae699b67734efd86030ae05827857c4678e4c6bd3e34e29c7de5f92a0eca57e10c72f76833787951688dfa6dbc1b3d295694887b
6
+ metadata.gz: eca6163e0fa1c90d95d57b4dcb4c1dd8e59088132589755ca0a09a675f9b7373821b48f83136ab7733d4559fe5a11cde756bf2c0b4d6979ae9c3c0464f9a6db4
7
+ data.tar.gz: 5db64e5d3d0db62691ea62adad65bf505faeee4dd4b4dc242021d307b34e03999e3639e5d070f39547bba00fcf28e570f3e60eea19c4b13bef91f515c01439bb
@@ -19,7 +19,7 @@ module DingSDK
19
19
  end
20
20
 
21
21
 
22
- sig { params(customer_uuid: ::String, phone_number: ::String).returns(Utils::FieldAugmented) }
22
+ sig { params(customer_uuid: ::String, phone_number: ::String).returns(::DingSDK::Operations::LookupResponse) }
23
23
  def lookup(customer_uuid, phone_number)
24
24
  # lookup - Perform a phone number lookup
25
25
  request = ::DingSDK::Operations::LookupRequest.new(
data/lib/ding_sdk/otp.rb CHANGED
@@ -19,7 +19,7 @@ module DingSDK
19
19
  end
20
20
 
21
21
 
22
- sig { params(request: T.nilable(::DingSDK::Shared::CreateCheckRequest)).returns(Utils::FieldAugmented) }
22
+ sig { params(request: T.nilable(::DingSDK::Shared::CreateCheckRequest)).returns(::DingSDK::Operations::CheckResponse) }
23
23
  def check(request)
24
24
  # check - Check a code
25
25
  url, params = @sdk_configuration.get_server_details
@@ -63,7 +63,7 @@ module DingSDK
63
63
  end
64
64
 
65
65
 
66
- sig { params(request: T.nilable(::DingSDK::Shared::CreateAuthenticationRequest)).returns(Utils::FieldAugmented) }
66
+ sig { params(request: T.nilable(::DingSDK::Shared::CreateAuthenticationRequest)).returns(::DingSDK::Operations::CreateAutenticationResponse) }
67
67
  def create_autentication(request)
68
68
  # create_autentication - Send a code
69
69
  url, params = @sdk_configuration.get_server_details
@@ -107,7 +107,7 @@ module DingSDK
107
107
  end
108
108
 
109
109
 
110
- sig { params(request: T.nilable(::DingSDK::Shared::RetryAuthenticationRequest)).returns(Utils::FieldAugmented) }
110
+ sig { params(request: T.nilable(::DingSDK::Shared::RetryAuthenticationRequest)).returns(::DingSDK::Operations::RetryResponse) }
111
111
  def retry(request)
112
112
  # retry - Perform a retry
113
113
  url, params = @sdk_configuration.get_server_details
@@ -38,9 +38,9 @@ module DingSDK
38
38
  @server = ''
39
39
  @language = 'ruby'
40
40
  @openapi_doc_version = '1.0.0'
41
- @sdk_version = '0.7.2'
42
- @gen_version = '2.258.0'
43
- @user_agent = 'speakeasy-sdk/ruby 0.7.2 2.258.0 1.0.0 ding_sdk'
41
+ @sdk_version = '0.7.4'
42
+ @gen_version = '2.263.3'
43
+ @user_agent = 'speakeasy-sdk/ruby 0.7.4 2.263.3 1.0.0 ding_sdk'
44
44
  end
45
45
 
46
46
  sig { returns([String, T::Hash[Symbol, String]]) }
@@ -62,28 +62,24 @@ module DingSDK
62
62
  end
63
63
  fields.each do |field|
64
64
  field_type = field.type
65
- if field.type.respond_to?(:types) && field.type.types.length == 2
66
- type2 = field.type.types[1]
67
- if type2.raw_type == NilClass
68
- field_type = field.type.types[0]
69
- field_type = field_type.raw_type if field_type.respond_to? :raw_type
70
- end
65
+ if T.nilable? field_type
66
+ field_type = T.nilable_of(field_type)
71
67
  end
72
68
 
73
-
74
69
  key = "#{field.name}="
75
70
  lookup = field.metadata.fetch(:format_json, {}).fetch(:letter_case, nil).call
76
71
  value = d[lookup]
77
72
  next if value.nil?
78
73
 
79
- if field_type.to_s.start_with? 'T::Array'
80
- inner_type = field_type.type.raw_type
74
+ if T.arr? field_type
75
+ inner_type = T.arr_of(field_type)
81
76
  unmarshalled_array = value.map { |f| unmarshal_single(inner_type, f) }
82
77
  to_build.send(key, unmarshalled_array)
83
- elsif field_type.to_s.start_with? 'T::Hash'
84
- _, val_type = field_type.type.types
78
+ elsif T.hash? field_type
79
+ val_type = T.hash_of(field_type)
80
+
85
81
  # rubocop:disable Style/HashTransformValues
86
- unmarshalled_hash = value.map { |k, v| [k, unmarshal_single(val_type.raw_type, v)] }.to_h
82
+ unmarshalled_hash = value.map { |k, v| [k, unmarshal_single(val_type, v)] }.to_h
87
83
  # rubocop:enable Style/HashTransformValues
88
84
  to_build.send(key, unmarshalled_hash)
89
85
  else
@@ -0,0 +1,59 @@
1
+ # Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ module T
7
+ def self.arr?(t)
8
+ if t.respond_to? :underlying_class
9
+ return t.underlying_class == ::Array
10
+ end
11
+ false
12
+ end
13
+
14
+ def self.arr_of(t)
15
+ get_raw_type(t.type)
16
+ end
17
+
18
+ def self.hash?(t)
19
+ if t.respond_to? :underlying_class
20
+ return t.underlying_class == ::Hash
21
+ end
22
+ false
23
+ end
24
+
25
+ def self.hash_of(t)
26
+ get_raw_type(t.values)
27
+ end
28
+
29
+ def self.nilable?(t)
30
+ t.respond_to? :unwrap_nilable
31
+ end
32
+
33
+ def self.nilable_of(t)
34
+ if t.respond_to? :unwrap_nilable
35
+ return simplify_type t.unwrap_nilable
36
+ end
37
+ nil
38
+ end
39
+
40
+ def self.simplifiable?(t)
41
+ return t.is_a? T::Types::Simple
42
+ end
43
+
44
+ def self.simplify_type(t)
45
+ if t.is_a? T::Types::Simple
46
+ return t.raw_type
47
+ end
48
+ t
49
+ end
50
+
51
+ def self.get_raw_type(t)
52
+ if t.respond_to? :raw_type
53
+ return t.raw_type
54
+ elsif t.respond_to? :raw_a
55
+ return T::Boolean if t.raw_a in [TrueClass, FalseClass]
56
+ end
57
+ t
58
+ end
59
+ end
@@ -742,7 +742,7 @@ module DingSDK
742
742
  end
743
743
  end
744
744
 
745
- sig { params(data: String, type: Object).returns(Object) }
745
+ sig { params(data: Object, type: Object).returns(Object) }
746
746
  def self.unmarshal_complex(data, type)
747
747
  begin
748
748
  value = unmarshal_json(JSON.parse(data), type)
@@ -754,20 +754,15 @@ module DingSDK
754
754
 
755
755
  sig { params(data: Object, type: Object).returns(Object) }
756
756
  def self.unmarshal_json(data, type)
757
+ if T.simplifiable? type
758
+ type = T.simplify_type type
759
+ end
757
760
  if type.respond_to? :unmarshal_json
758
761
  type.unmarshal_json(data)
759
- elsif type.to_s.start_with? 'T::Array'
760
- if type.type.respond_to? :raw_type
761
- data.map { |v| Utils.unmarshal_complex(v, type.type.raw_type) }
762
- else
763
- data.map { |v| Utils.unmarshal_complex(v, type.type) }
764
- end
765
- elsif type.to_s.start_with? 'T::Hash'
766
- if type.type.types[1].respond_to? :raw_type
767
- data.transform_values { |v| Utils.unmarshal_complex(v, type.type.types[1].raw_type) }
768
- else
769
- data.transform_values { |v| Utils.unmarshal_complex(v, type.type.types[1]) }
770
- end
762
+ elsif T.arr? type
763
+ data.map { |v| Utils.unmarshal_complex(v, T.arr_of(type)) }
764
+ elsif T.hash? type
765
+ data.transform_values { |v| Utils.unmarshal_complex(v, T.hash_of(type)) }
771
766
  else
772
767
  data
773
768
  end
data/lib/ding_sdk.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # typed: true
4
4
  # frozen_string_literal: true
5
5
 
6
+ require_relative 'ding_sdk/utils/t'
6
7
  require_relative 'ding_sdk/utils/utils'
7
8
  require_relative 'ding_sdk/utils/metadata_fields'
8
9
  module DingSDK
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ding_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ding
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-15 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -170,14 +170,15 @@ files:
170
170
  - lib/ding_sdk/otp.rb
171
171
  - lib/ding_sdk/sdkconfiguration.rb
172
172
  - lib/ding_sdk/utils/metadata_fields.rb
173
+ - lib/ding_sdk/utils/t.rb
173
174
  - lib/ding_sdk/utils/utils.rb
174
- homepage: https://github.com/speakeasy-api/openapi-generation
175
+ homepage: https://github.com/ding-live/ding-ruby.git
175
176
  licenses:
176
177
  - Apache-2.0
177
178
  metadata:
178
- homepage_uri: https://github.com/speakeasy-api/openapi-generation
179
- documentation_uri: https://github.com/speakeasy-api/openapi-generation
180
- source_code_uri: https://github.com/speakeasy-api/openapi-generation
179
+ homepage_uri: https://github.com/ding-live/ding-ruby.git
180
+ documentation_uri: https://github.com/ding-live/ding-ruby.git
181
+ source_code_uri: https://github.com/ding-live/ding-ruby.git
181
182
  post_install_message:
182
183
  rdoc_options: []
183
184
  require_paths: