apimatic_core 0.2.0 → 0.2.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: 43a0787b023f7ffa1b7c2a85955b951607f73678560cd1ae5ed5093a98e39787
4
- data.tar.gz: 6753fbba0aeb9f496c4a926a226b55fe6aa6245b836ac027fd86d0b9cb295a12
3
+ metadata.gz: d29b21091f739c5f0023b01fd70b174a41b6b25637248a02f5be3283874a25eb
4
+ data.tar.gz: f21de623d02c62af2818602f81657983883d0885187836e609b16ddf890d0d3c
5
5
  SHA512:
6
- metadata.gz: a3d9f9fe3b80a7980b632ac2a6b3fa34780aec0e94cefc7f8f0f1a4a632e99e0da7b2d66cf48f279356cee3486c4595e1ebe48764afcaa7344562732a91ea7f2
7
- data.tar.gz: 125c4d4c4dadcd5c069b78eed5b703493e46e666575d1e926acb0e7a4b62099627ed97d8703b502e5e2d476edbf14e34f4438b4733198e00ca5b13a8378cbbf6
6
+ metadata.gz: abd28994bd548acfd533bcdd1879d2d8c5ebf67198b97d3172f559d537a1ea9e688c0b5ff076849c4d818d32389814f0b5e42090d11aaf3866de73e626ff1ea6
7
+ data.tar.gz: 011162e182da68a14d8e820ddf3ca2932f2658afc0e2a15836f042a02d104476888d90c4ce0932f6d47ee8e3df5c5bc23b489bd16bf9f628551ff9183492dcf9
data/LICENSE CHANGED
@@ -1,26 +1,21 @@
1
- APIMATIC REFERENCE SOURCE LICENSE
2
-
3
- This license governs the use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
4
-
5
- 1. Definitions
6
- The terms "reproduce," "reproduction" and "distribution" have the same meaning here as under U.S. copyright law.
7
-
8
- "You" means the licensee of the software.
9
-
10
- "Your company" means the company you worked for when you downloaded the software.
11
-
12
- "Reference use" means the use of the software within your company as a reference, in read-only form, for the sole purposes of debugging your products, maintaining your products, or enhancing the interoperability of your products with the software, and specifically excludes the right to distribute the software outside of your company.
13
-
14
- "Licensed patents" means any Licensor patent claims which read directly on the software as distributed by the Licensor under this license.
15
-
16
- 2. Grant of Rights
17
- (A) Copyright Grant- Subject to the terms of this license, the Licensor grants you a non-transferable, non-exclusive, worldwide, royalty-free copyright license to reproduce the software for reference use.
18
-
19
- (B) Patent Grant- Subject to the terms of this license, the Licensor grants you a non-transferable, non-exclusive, worldwide, royalty-free patent license under licensed patents for reference use.
20
-
21
- 3. Limitations
22
- (A) No Trademark License- This license does not grant you any rights to use the Licensor's name, logo, or trademarks.
23
-
24
- (B) If you begin patent litigation against the Licensor over patents that you think may apply to the software (including a cross-claim or counterclaim in a lawsuit), your license to the software ends automatically.
25
-
26
- (C) The software is licensed "as-is." You bear the risk of using it. The Licensor gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the Licensor excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 APIMatic Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -95,5 +95,5 @@ gem 'apimatic_core'
95
95
  [code-climate-url]: https://codeclimate.com/github/apimatic/core-lib-ruby
96
96
  [maintainability-url]: https://api.codeclimate.com/v1/badges/85d658cd4e879f057e7d/maintainability
97
97
  [test-coverage-url]: https://api.codeclimate.com/v1/badges/85d658cd4e879f057e7d/test_coverage
98
- [license-badge]: https://img.shields.io/badge/licence-APIMATIC-blue
98
+ [license-badge]: https://img.shields.io/badge/licence-MIT-blue
99
99
  [license-url]: LICENSE
@@ -7,6 +7,9 @@ module CoreLibrary
7
7
  ApiCall.new(@global_configuration, logger: @endpoint_logger.logger)
8
8
  end
9
9
 
10
+ # Initializes a new instance of ApiCall.
11
+ # @param [GlobalConfiguration] global_configuration An instance of GlobalConfiguration.
12
+ # @param logger An optional logger to log execution of program.
10
13
  def initialize(global_configuration, logger: nil)
11
14
  @global_configuration = global_configuration
12
15
  @request_builder = RequestBuilder.new
@@ -1,6 +1,8 @@
1
1
  module CoreLibrary
2
2
  # This class is responsible for adding authentication in request header parameter.
3
3
  class HeaderAuth < Authentication
4
+ # Initializes a new instance of HeaderAuth.
5
+ # @param [Hash] auth_params Auth params for header auth.
4
6
  def initialize(auth_params)
5
7
  @auth_params = auth_params
6
8
  @error_message = nil
@@ -7,6 +7,8 @@ module CoreLibrary
7
7
  @error_messages.join(' and ')
8
8
  end
9
9
 
10
+ # Initializes a new instance of And.
11
+ # @param [String | AuthGroup] auth_group AuthGroup instance or string.
10
12
  def initialize(*auth_group)
11
13
  super auth_group
12
14
  @is_valid_group = true
@@ -4,6 +4,8 @@ module CoreLibrary
4
4
  class AuthGroup < Authentication
5
5
  attr_accessor :auth_participants, :mapped_group, :error_messages, :is_valid_group
6
6
 
7
+ # Initializes a new instance of AuthGroup.
8
+ # @param [String | AuthGroup] auth_group AuthGroup instance or string.
7
9
  def initialize(auth_group)
8
10
  @auth_participants = []
9
11
  auth_group.each do |auth_participant|
@@ -7,6 +7,8 @@ module CoreLibrary
7
7
  @error_messages.join(' or ')
8
8
  end
9
9
 
10
+ # Initializes a new instance of Or.
11
+ # @param [String | AuthGroup] auth_group AuthGroup instance or string.
10
12
  def initialize(*auth_group)
11
13
  super auth_group
12
14
  @is_valid_group = false
@@ -7,6 +7,8 @@ module CoreLibrary
7
7
  "[#{@error_message}]"
8
8
  end
9
9
 
10
+ # Initializes a new instance of Single.
11
+ # @param [String] auth_participant Auth participant name.
10
12
  def initialize(auth_participant)
11
13
  @auth_participant = auth_participant
12
14
  @mapped_auth = nil
@@ -1,6 +1,8 @@
1
1
  module CoreLibrary
2
2
  # This class is responsible for adding authentication in request query parameter.
3
3
  class QueryAuth < Authentication
4
+ # Initializes a new instance of QueryAuth.
5
+ # @param [Hash] auth_params Auth params for query auth.
4
6
  def initialize(auth_params)
5
7
  @auth_params = auth_params
6
8
  @error_message = nil
@@ -3,6 +3,8 @@ module CoreLibrary
3
3
  class GlobalConfiguration
4
4
  attr_reader :client_configuration
5
5
 
6
+ # Initializes a new instance of GlobalConfiguration.
7
+ # @param [HttpClientConfiguration] client_configuration Current HttpClientConfiguration.
6
8
  def initialize(client_configuration: HttpClientConfiguration.new)
7
9
  @client_configuration = client_configuration
8
10
  @global_errors = {}
@@ -29,11 +31,14 @@ module CoreLibrary
29
31
  end
30
32
 
31
33
  # Sets the current SDK module core library is being used for.
34
+ # @return [GlobalConfiguration] Current Instance.
32
35
  def sdk_module(sdk_module)
33
36
  @sdk_module = sdk_module
34
37
  self
35
38
  end
36
39
 
40
+ # Getter for the current SDK module the core library is being used for.
41
+ # @return [Module] Current SDK module.
37
42
  def get_sdk_module
38
43
  @sdk_module
39
44
  end
@@ -3,6 +3,19 @@ module CoreLibrary
3
3
  class HttpClientConfiguration < ClientConfiguration
4
4
  attr_reader :http_client, :http_callback
5
5
 
6
+ # Initializes a new instance of HttpClientConfiguration.
7
+ # @param connection Connection information
8
+ # @param adapter Adapter configuration
9
+ # @param [Integer] timeout Timeout value
10
+ # @param [Integer] max_retries Max retries values
11
+ # @param [Integer] retry_interval Retry interval value, in seconds
12
+ # @param [Integer] backoff_factor Backoff factor
13
+ # @param [Array] retry_statuses An integer array of http status codes
14
+ # @param [Hash] retry_methods A string array of methods
15
+ # @param [Boolean] cache Should cache be enabled
16
+ # @param [Boolean] verify Should verification be enabled.
17
+ # @param http_callback A method to be used as http callback
18
+ # @param [HttpClient] http_client An instance of HttpClient
6
19
  def initialize(
7
20
  connection: nil, adapter: :net_http_persistent, timeout: 60,
8
21
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
@@ -3,6 +3,8 @@ module CoreLibrary
3
3
  class EndpointLogger
4
4
  attr_reader :logger
5
5
 
6
+ # Initializes a new instance of EndpointLogger.
7
+ # @param logger A logger with methods info, debug and error.
6
8
  def initialize(logger)
7
9
  @logger = logger
8
10
  end
@@ -1,6 +1,7 @@
1
1
  module CoreLibrary
2
2
  # This class is the builder of the http request for an API call.
3
3
  class RequestBuilder
4
+ # Creates an instance of RequestBuilder.
4
5
  def initialize
5
6
  @server = nil
6
7
  @path = nil
@@ -1,6 +1,7 @@
1
1
  module CoreLibrary
2
- # This class is for handling of the http response for an API call.
2
+ # Creates an instance of ResponseHandler.
3
3
  class ResponseHandler
4
+ # Creates an instance of ResponseHandler.
4
5
  def initialize
5
6
  @deserializer = nil
6
7
  @convertor = nil
@@ -1,6 +1,7 @@
1
1
  module CoreLibrary
2
2
  # This data class represents the expected errors to be handled after the API call.
3
3
  class ErrorCase
4
+ # Initializes a new instance of ErrorCase.
4
5
  def initialize
5
6
  @error_message = nil
6
7
  @error_message_template = nil
@@ -1,6 +1,7 @@
1
1
  module CoreLibrary
2
2
  # This data class represents the parameter to be sent in the request.
3
3
  class Parameter
4
+ # Initializes a new instance of Parameter.
4
5
  def initialize
5
6
  @key = nil
6
7
  @value = nil
@@ -87,12 +88,16 @@ module CoreLibrary
87
88
  @default_content_type
88
89
  end
89
90
 
90
- # Template in case of oneOf or anyOf
91
+ # Template setter in case of oneOf or anyOf.
92
+ # @param [String] template Template for the parameter.
93
+ # @return [Parameter] An updated instance of Parameter.
91
94
  def template(template)
92
95
  @template = template
93
96
  self
94
97
  end
95
98
 
99
+ # Template getter in case a template is set.
100
+ # @return [Parameter] Returns template for the parameter.
96
101
  def get_template
97
102
  @template
98
103
  end
@@ -3,6 +3,9 @@ module CoreLibrary
3
3
  class FileWrapper
4
4
  attr_reader :content_type, :file
5
5
 
6
+ # Initializes a new instance of FileWrapper.
7
+ # @param [File] file File to enclose within file wrapper.
8
+ # @param [String] content_type Content type of file.
6
9
  def initialize(file, content_type: 'application/octet-stream')
7
10
  @file = file
8
11
  @content_type = content_type
@@ -1,35 +1,45 @@
1
1
  module CoreLibrary
2
2
  # The class to hold the configuration for XML parameter in request and response.
3
3
  class XmlAttributes
4
+ # Initializes a new instance of XmlAttributes.
4
5
  def initialize
5
6
  @value = nil
6
7
  @root_element_name = nil
7
8
  @array_item_name = nil
8
9
  end
9
10
 
11
+ # Value setter for XML parameter.
12
+ # @return [XmlAttributes] An updated instance of XmlAttributes.
10
13
  def value(value)
11
14
  @value = value
12
15
  self
13
16
  end
14
17
 
18
+ # Setter for root_element_name of XmlAttributes.
19
+ # @return [XmlAttributes] An updated instance of XmlAttributes.
15
20
  def root_element_name(root_element_name)
16
21
  @root_element_name = root_element_name
17
22
  self
18
23
  end
19
24
 
25
+ # Setter for array item name in XmlAttributes.
26
+ # @return [XmlAttributes] An updated instance of XmlAttributes.
20
27
  def array_item_name(array_item_name)
21
28
  @array_item_name = array_item_name
22
29
  self
23
30
  end
24
31
 
32
+ # Getter for root element of XmlAttributes.
25
33
  def get_root_element_name
26
34
  @root_element_name
27
35
  end
28
36
 
37
+ # Getter for value of XmlAttributes.
29
38
  def get_value
30
39
  @value
31
40
  end
32
41
 
42
+ # Getter for the set array item name in XmlAttributes.
33
43
  def get_array_item_name
34
44
  @array_item_name
35
45
  end
@@ -2,7 +2,7 @@ module CoreLibrary
2
2
  # A utility that perform the comparison of the Response body and headers.
3
3
  class ComparisonHelper
4
4
 
5
- # Class method to compare the received headers with the expected headers.
5
+ # Compares the received headers with the expected headers.
6
6
  # @param [Hash] expected_headers A hash of expected headers (keys in lower case).
7
7
  # @param [Hash] actual_headers A hash of actual headers.
8
8
  # @param [Boolean, optional] allow_extra A flag which determines if we allow extra headers.
@@ -24,7 +24,7 @@ module CoreLibrary
24
24
  return true
25
25
  end
26
26
 
27
- # Class method to compare the received body with the expected body.
27
+ # Compares the received body with the expected body.
28
28
  # @param [Dynamic] expected_body The expected body.
29
29
  # @param [Dynamic] actual_body The actual body.
30
30
  # @param [Boolean, optional] check_values A flag which determines if we check values in dictionaries.
@@ -4,9 +4,10 @@ module CoreLibrary
4
4
  # A utility class for handling xml parsing.
5
5
  class XmlHelper
6
6
  class << self
7
- # Serialized the provided value to XML.
8
- # @param root_element_name Root element for the XML provided.
9
- # @param value Value to convert to XML.
7
+ # Serializes the provided value to XML.
8
+ # @param [String] root_element_name Root element for the XML provided.
9
+ # @param [String] value Value to convert to XML.
10
+ # @param [CoreLibrary::DateTimeFormat] datetime_format The format to convert the date time into.
10
11
  def serialize_to_xml(root_element_name, value, datetime_format: nil)
11
12
  doc = Nokogiri::XML::Document.new
12
13
  add_as_subelement(doc, doc, root_element_name, value,
@@ -14,10 +15,11 @@ module CoreLibrary
14
15
  doc.to_xml
15
16
  end
16
17
 
17
- # Serialized the provided array value to XML.
18
- # @param root_element_name Root element for the xml provided.
19
- # @param item_name Item name for XML.
18
+ # Serializes the provided array value to XML.
19
+ # @param [String] root_element_name Root element for the xml provided.
20
+ # @param [String] item_name Item name for XML.
20
21
  # @param value Value to convert to XML.
22
+ # @param [CoreLibrary::DateTimeFormat] datetime_format The format to convert the date time into.
21
23
  def serialize_array_to_xml(root_element_name, item_name, value,
22
24
  datetime_format: nil)
23
25
  doc = Nokogiri::XML::Document.new
@@ -27,8 +29,10 @@ module CoreLibrary
27
29
  doc.to_xml
28
30
  end
29
31
 
30
- # Serialized the provided hash to XML.
31
- # @param root_element_name Root element for the XML provided.
32
+ # Serializes the provided hash to XML.
33
+ # @param [string] root_element_name Root element for the XML provided.
34
+ # @param [Hash] entries Entries to convert to XML.
35
+ # @param [CoreLibrary::DateTimeFormat] datetime_format The format to convert the date time into.
32
36
  def serialize_hash_to_xml(root_element_name, entries,
33
37
  datetime_format: nil)
34
38
  doc = Nokogiri::XML::Document.new
@@ -38,6 +42,10 @@ module CoreLibrary
38
42
  end
39
43
 
40
44
  # Adds the value as an attribute.
45
+ # @param [REXML::Element] root Root element of the XML to add the attribute to.
46
+ # @param [string] name Attribute name.
47
+ # @param [string] value Attribute value.
48
+ # @param [CoreLibrary::DateTimeFormat] datetime_format The format to convert the date time into.
41
49
  def add_as_attribute(root, name, value, datetime_format: nil)
42
50
  return if value.nil?
43
51
 
@@ -47,6 +55,11 @@ module CoreLibrary
47
55
  end
48
56
 
49
57
  # Adds hash as a sub-element.
58
+ # @param [Nokogiri::XML::Document] doc Document to add the hash to.
59
+ # @param [REXML::Element] root Root element of the XML to add the attribute to.
60
+ # @param [string] name Attribute name.
61
+ # @param [Hash] entries Hash to add as value.
62
+ # @param [CoreLibrary::DateTimeFormat] datetime_format The format to convert the date time into.
50
63
  def add_hash_as_subelement(doc, root, name, entries,
51
64
  datetime_format: nil)
52
65
  return if entries.nil?
@@ -61,6 +74,12 @@ module CoreLibrary
61
74
  end
62
75
 
63
76
  # Adds array as a sub-element.
77
+ # @param [Nokogiri::XML::Document] doc Document to add the hash to.
78
+ # @param [REXML::Element] root Root element of the XML to add the attribute to.
79
+ # @param [String] item_name Individual array item names.
80
+ # @param [Array] items Array of items.
81
+ # @param [String] wrapping_element_name Main array item name.
82
+ # @param [CoreLibrary::DateTimeFormat] datetime_format The format to convert the date time into.
64
83
  def add_array_as_subelement(doc, root, item_name, items,
65
84
  wrapping_element_name: nil,
66
85
  datetime_format: nil)
@@ -80,6 +99,11 @@ module CoreLibrary
80
99
  end
81
100
 
82
101
  # Adds as a sub-element.
102
+ # @param [Nokogiri::XML::Document] doc Document to add the hash to.
103
+ # @param [REXML::Element] root Root element of the XML to add the attribute to.
104
+ # @param [String] name Item name.
105
+ # @param [Array] value Item value.
106
+ # @param [CoreLibrary::DateTimeFormat] datetime_format The format to convert the date time into.
83
107
  def add_as_subelement(doc, root, name, value, datetime_format: nil)
84
108
  return if value.nil?
85
109
 
@@ -95,8 +119,8 @@ module CoreLibrary
95
119
  end
96
120
 
97
121
  # Converts datetime to string of a specific format.
98
- # @param value Value to convert to string.
99
- # @param datetime_format Datetime format for the converted string.
122
+ # @param [DateTime] value Value to convert to string.
123
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion..
100
124
  def datetime_to_s(value, datetime_format)
101
125
  case datetime_format
102
126
  when 'UnixDateTime'
@@ -109,9 +133,10 @@ module CoreLibrary
109
133
  end
110
134
 
111
135
  # Deserializes XML to a specific class.
112
- # @param xml The XML value to deserialize.
113
- # @param root_element_name Root element name for the XML provided.
114
- # @param clazz The class to convert the XML into.
136
+ # @param [String] xml The XML value to deserialize.
137
+ # @param [String] root_element_name Root element name for the XML provided.
138
+ # @param [Class] clazz The class to convert the XML into.
139
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion..
115
140
  def deserialize_xml(xml, root_element_name, clazz, datetime_format = nil)
116
141
  doc = Nokogiri::XML::Document.parse xml
117
142
  from_element(doc, root_element_name, clazz,
@@ -119,10 +144,10 @@ module CoreLibrary
119
144
  end
120
145
 
121
146
  # Deserializes XML to an array of a specific class.
122
- # @param xml The XML value to deserialize.
123
- # @param root_element_name Root element name for the XML provided.
124
- # @param item_name Item name for XML.
125
- # @param clazz The class to convert the XML into.
147
+ # @param [String] xml The XML value to deserialize.
148
+ # @param [String] root_element_name Root element name for the XML provided.
149
+ # @param [String] item_name Item name for XML.
150
+ # @param [Class] clazz The class to convert the XML into.
126
151
  def deserialize_xml_to_array(xml, root_element_name, item_name, clazz,
127
152
  datetime_format = nil)
128
153
  doc = Nokogiri::XML::Document.parse xml
@@ -132,8 +157,10 @@ module CoreLibrary
132
157
  end
133
158
 
134
159
  # Deserializes XML to an array of a specific class.
135
- # @param xml The XML value to deserialize.
136
- # @param root_element_name Root element name for the XML provided.
160
+ # @param [String] xml The XML value to deserialize.
161
+ # @param [String] root_element_name Root element name for the XML provided.
162
+ # @param [Class] clazz The class to convert the XML into.
163
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion..
137
164
  def deserialize_xml_to_hash(xml, root_element_name, clazz,
138
165
  datetime_format = nil)
139
166
  doc = Nokogiri::XML::Document.parse xml
@@ -142,6 +169,10 @@ module CoreLibrary
142
169
  end
143
170
 
144
171
  # Converts attribute to a specific class.
172
+ # @param [String] parent Parent XML.
173
+ # @param [String] name Attribute name.
174
+ # @param [Class] clazz Attribute class.
175
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion..
145
176
  def from_attribute(parent, name, clazz, datetime_format: nil)
146
177
  attribute = parent[name]
147
178
  return nil if attribute.nil?
@@ -150,6 +181,10 @@ module CoreLibrary
150
181
  end
151
182
 
152
183
  # Converts element to a specific class.
184
+ # @param [String] parent Parent XML.
185
+ # @param [String] name Attribute name.
186
+ # @param [Class] clazz Attribute class.
187
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion..
153
188
  def from_element(parent, name, clazz, datetime_format: nil)
154
189
  element = parent.at_xpath(name)
155
190
  return nil if element.nil?
@@ -159,6 +194,11 @@ module CoreLibrary
159
194
  end
160
195
 
161
196
  # Converts element to an array.
197
+ # @param [String] parent Parent XML.
198
+ # @param [String] item_name Element name.
199
+ # @param [Class] clazz Element class.
200
+ # @param [String] wrapping_element_name Main element name.
201
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion..
162
202
  def from_element_to_array(parent, item_name, clazz,
163
203
  wrapping_element_name: nil,
164
204
  datetime_format: nil)
@@ -182,6 +222,11 @@ module CoreLibrary
182
222
  end
183
223
 
184
224
  # Converts element to hash.
225
+ # @param [Nokogiri::XML::Document] parent Parent document.
226
+ # @param [String] name Element name.
227
+ # @param [Class] clazz Hash class to convert to.
228
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion.
229
+ # @return [Object] Converted value.
185
230
  def from_element_to_hash(parent, name, clazz,
186
231
  datetime_format: nil)
187
232
  entries = parent.at_xpath(name)
@@ -197,6 +242,10 @@ module CoreLibrary
197
242
  end
198
243
 
199
244
  # Basic convert method.
245
+ # @param [String] value Value to convert type of.
246
+ # @param [Class] clazz Type to convert into.
247
+ # @param [CoreLibrary::DateTimeFormat] datetime_format Datetime format to use for conversion..
248
+ # @return [Object] Converted value.
200
249
  def convert(value, clazz, datetime_format)
201
250
  if clazz == DateTime
202
251
  return DateTime.rfc3339(value) if datetime_format == 'RFC3339DateTime'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apimatic_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-31 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apimatic_core_interfaces
@@ -204,7 +204,7 @@ files:
204
204
  - lib/apimatic_core.rb
205
205
  homepage: https://apimatic.io
206
206
  licenses:
207
- - APIMATIC REFERENCE SOURCE LICENSE
207
+ - MIT
208
208
  metadata: {}
209
209
  post_install_message:
210
210
  rdoc_options: []
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  requirements: []
224
- rubygems_version: 3.4.1
224
+ rubygems_version: 3.4.6
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: A library that contains apimatic-apimatic-core logic and utilities for consuming