apimatic_core 0.3.16 → 0.3.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: 6ecc4f4597c759974681f7105595172534b8ae7864654711e4f7ed04db6fa518
4
- data.tar.gz: d9d62ba896f853026f2d52f242241048a91ae5e49a1b5906b2c1ee78ee3559e3
3
+ metadata.gz: 2b0a483f088067743a544f3de82e94a1fd7e69c8ae909183b78f4d1ef5b1ae58
4
+ data.tar.gz: cd450513cff448d0a5c26ab010965d1a6c96c69aaa4d28867a4837b23860ddd0
5
5
  SHA512:
6
- metadata.gz: 3df51d480ddfc862d60c5452f6b15a71d091ebe64db5e5f86ef885ee402f9dffabee2a644a94c33a6572ce55383b04cf8720b4d70f9d87fece77da65741c9626
7
- data.tar.gz: 7eda9192920928a35a9d9e09bf2937348972aa8bcdaf37fdd153da1abf357b9c259cee74e59c17e1845cbb2fb57cbcd18997dd5e5c381422d0e74ac692249368
6
+ metadata.gz: e979257d3120334ba5b91869185aabb76a370d9fb7e8dff380d11275be052dcee00162b46e72e426812f4228b0c93fb7eda06bdc12ecdfce931b2529d00475ec
7
+ data.tar.gz: 2adbc4d4e20342ff76a26b90225a6cce77e0ff7ba2a6ee0d7e1904682369a561c513a5b6fe9668ed0fd801ec49d445d496f520ddc9b96e05934dabd1ee7d3d53
data/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/apimatic_core.svg)](https://badge.fury.io/rb/apimatic_core)
4
4
  [![Tests][test-badge]][test-url]
5
5
  [![Linting][lint-badge]][lint-url]
6
- [![Test Coverage][test-coverage-url]][code-climate-url]
6
+ [![Test Coverage][coverage-badge]][coverage-url]
7
+ [![Maintainability Rating][maintainability-badge]][maintainability-url]
8
+ [![Vulnerabilities][vulnerabilities-badge]][vulnerabilities-url]
7
9
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
8
10
  [![Licence][license-badge]][license-url]
9
11
 
@@ -125,8 +127,11 @@ gem 'apimatic_core'
125
127
  [test-url]: https://github.com/apimatic/core-lib-ruby/actions/workflows/test-runner.yml
126
128
  [lint-badge]: https://github.com/apimatic/core-lib-ruby/actions/workflows/lint-runner.yml/badge.svg
127
129
  [lint-url]: https://github.com/apimatic/core-lib-ruby/actions/workflows/lint-runner.yml
128
- [code-climate-url]: https://codeclimate.com/github/apimatic/core-lib-ruby
129
- [maintainability-url]: https://api.codeclimate.com/v1/badges/85d658cd4e879f057e7d/maintainability
130
- [test-coverage-url]: https://api.codeclimate.com/v1/badges/85d658cd4e879f057e7d/test_coverage
130
+ [coverage-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-lib-ruby&metric=coverage
131
+ [coverage-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-lib-ruby
132
+ [maintainability-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-lib-ruby&metric=sqale_rating
133
+ [maintainability-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-lib-ruby
134
+ [vulnerabilities-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-lib-ruby&metric=vulnerabilities
135
+ [vulnerabilities-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-lib-ruby
131
136
  [license-badge]: https://img.shields.io/badge/licence-MIT-blue
132
137
  [license-url]: LICENSE
@@ -3,6 +3,12 @@ module CoreLibrary
3
3
  class ApiCall
4
4
  attr_reader :request_builder, :pagination_strategy_list, :global_configuration
5
5
 
6
+ # Creates a new builder instance of the API call with pre-configured global and logging configurations.
7
+ # @return [ApiCall] The instance of ApiCall object.
8
+ def new_builder
9
+ ApiCall.new(@global_configuration)
10
+ end
11
+
6
12
  # Initializes a new instance of ApiCall.
7
13
  # @param [GlobalConfiguration] global_configuration An instance of GlobalConfiguration.
8
14
  def initialize(global_configuration)
@@ -72,8 +72,11 @@ module CoreLibrary
72
72
 
73
73
  # Deserializer to use when the type of response is not known beforehand.
74
74
  # @param response The response received.
75
+ # @return [Hash, Array, nil] The deserialized response.
75
76
  def self.dynamic_deserializer(response, should_symbolize)
76
- json_deserialize(response, should_symbolize) unless response.nil? || response.to_s.strip.empty?
77
+ return unless deserializable_json?(response)
78
+
79
+ json_deserialize(response, should_symbolize)
77
80
  end
78
81
 
79
82
  # Deserializes response to a known custom model type.
@@ -303,6 +306,20 @@ module CoreLibrary
303
306
  end
304
307
  end
305
308
 
309
+ # Checks whether the content is deserializable JSON.
310
+ # @param [String] json A JSON string.
311
+ # @return [Boolean] True if the content can be deserialized, false otherwise.
312
+ def self.deserializable_json?(json)
313
+ return false if json.nil? || json.to_s.strip.empty?
314
+
315
+ begin
316
+ JSON.parse(json)
317
+ true
318
+ rescue JSON::ParserError
319
+ false
320
+ end
321
+ end
322
+
306
323
  # Parses JSON string.
307
324
  # @param [object] obj The object to serialize.
308
325
  def self.json_serialize(obj)
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.3.16
4
+ version: 0.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-18 00:00:00.000000000 Z
11
+ date: 2025-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apimatic_core_interfaces