test-words-api-client-sdk 1.0.0

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.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +76 -0
  4. data/lib/words_api/api_helper.rb +10 -0
  5. data/lib/words_api/client.rb +60 -0
  6. data/lib/words_api/configuration.rb +127 -0
  7. data/lib/words_api/controllers/ap_is_controller.rb +134 -0
  8. data/lib/words_api/controllers/base_controller.rb +66 -0
  9. data/lib/words_api/exceptions/api_exception.rb +10 -0
  10. data/lib/words_api/http/auth/custom_header_authentication.rb +44 -0
  11. data/lib/words_api/http/http_call_back.rb +10 -0
  12. data/lib/words_api/http/http_method_enum.rb +10 -0
  13. data/lib/words_api/http/http_request.rb +10 -0
  14. data/lib/words_api/http/http_response.rb +10 -0
  15. data/lib/words_api/models/base_model.rb +62 -0
  16. data/lib/words_api/models/definitions_response.rb +56 -0
  17. data/lib/words_api/models/examples_response.rb +56 -0
  18. data/lib/words_api/models/frequency_details.rb +64 -0
  19. data/lib/words_api/models/frequency_response.rb +56 -0
  20. data/lib/words_api/models/pronunciation_details.rb +67 -0
  21. data/lib/words_api/models/pronunciation_response.rb +57 -0
  22. data/lib/words_api/models/syllable_details.rb +59 -0
  23. data/lib/words_api/models/synonyms_response.rb +56 -0
  24. data/lib/words_api/models/word_details.rb +152 -0
  25. data/lib/words_api/models/word_response.rb +94 -0
  26. data/lib/words_api/utilities/date_time_helper.rb +11 -0
  27. data/lib/words_api/utilities/file_wrapper.rb +16 -0
  28. data/lib/words_api.rb +49 -0
  29. data/test/controllers/controller_test_base.rb +29 -0
  30. data/test/controllers/test_ap_is_controller.rb +171 -0
  31. data/test/http_response_catcher.rb +19 -0
  32. metadata +146 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4340cf9d35dd41ed353e9ba318b4cebde5c304c063696e57eff2efd280ae8d56
4
+ data.tar.gz: dd9351acfc7c32846c9f050eb64121ab083bfbbe18fd7508c219c257060eebd6
5
+ SHA512:
6
+ metadata.gz: ef89f97caf264b46b81e68f9e3f7e093522b472b7bfdaac05ef142f050d8f130cd6cce07d96ac171752c517fd3192ac61e4b030c42c8e64f47a2eff378af7204
7
+ data.tar.gz: 7569b977c15e24e9513c9d0bb6c00a04a157636ba1af2f71a22b05df03c620781fe85a6f68c219967cc685d6f3264c8b7bb3ddc2edafb9e8a61422eb79261c0e
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2024 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+
2
+ # Getting Started with Words API
3
+
4
+ ## Introduction
5
+
6
+ Words API lets you retrieve information about English words, including definitions, synonyms, rhymes, pronunciation, syllables, and frequency of usage. It also can tell you about relationships between words, for instance that “math” has categories like “algebra” and “geometry”, or that a “finger” is part of a “hand”.
7
+
8
+ ## Install the Package
9
+
10
+ Install the gem from the command line:
11
+
12
+ ```ruby
13
+ gem install test-words-api-client-sdk -v 1.0.0
14
+ ```
15
+
16
+ Or add the gem to your Gemfile and run `bundle`:
17
+
18
+ ```ruby
19
+ gem 'test-words-api-client-sdk', '1.0.0'
20
+ ```
21
+
22
+ For additional gem details, see the [RubyGems page for the test-words-api-client-sdk gem](https://rubygems.org/gems/test-words-api-client-sdk/versions/1.0.0).
23
+
24
+ ## Test the SDK
25
+
26
+ To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
27
+
28
+ ```
29
+ rake
30
+ ```
31
+
32
+ ## Initialize the API Client
33
+
34
+ **_Note:_** Documentation for the client can be found [here.](doc/client.md)
35
+
36
+ The following parameters are configurable for the API Client:
37
+
38
+ | Parameter | Type | Description |
39
+ | --- | --- | --- |
40
+ | `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
41
+ | `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
42
+ | `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
43
+ | `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
44
+ | `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
45
+ | `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
46
+ | `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
47
+ | `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
48
+ | `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
49
+ | `custom_header_authentication_credentials` | [`CustomHeaderAuthenticationCredentials`](__base_path/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
50
+
51
+ The API client can be initialized as follows:
52
+
53
+ ```ruby
54
+ client = WordsApi::Client.new(
55
+ custom_header_authentication_credentials: CustomHeaderAuthenticationCredentials.new(
56
+ x_rapid_api_key: 'X-RapidAPI-Key'
57
+ )
58
+ )
59
+ ```
60
+
61
+ ## Authorization
62
+
63
+ This API uses the following authentication schemes.
64
+
65
+ * [`RapidAPI-Key (Custom Header Signature)`](__base_path/auth/custom-header-signature.md)
66
+
67
+ ## List of APIs
68
+
69
+ * [AP Is](doc/controllers/ap-is.md)
70
+
71
+ ## Classes Documentation
72
+
73
+ * [Utility Classes](doc/utility-classes.md)
74
+ * [HttpResponse](doc/http-response.md)
75
+ * [HttpRequest](doc/http-request.md)
76
+
@@ -0,0 +1,10 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,60 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # words_api client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ # Access to ap_is controller.
13
+ # @return [APIsController] Returns the controller instance.
14
+ def ap_is
15
+ @ap_is ||= APIsController.new @global_configuration
16
+ end
17
+
18
+ def initialize(
19
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
20
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
21
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
22
+ retry_methods: %i[get put], http_callback: nil,
23
+ environment: Environment::PRODUCTION, x_rapid_api_key: nil,
24
+ custom_header_authentication_credentials: nil, config: nil
25
+ )
26
+ @config = if config.nil?
27
+ Configuration.new(
28
+ connection: connection, adapter: adapter, timeout: timeout,
29
+ max_retries: max_retries, retry_interval: retry_interval,
30
+ backoff_factor: backoff_factor,
31
+ retry_statuses: retry_statuses,
32
+ retry_methods: retry_methods, http_callback: http_callback,
33
+ environment: environment, x_rapid_api_key: x_rapid_api_key,
34
+ custom_header_authentication_credentials: custom_header_authentication_credentials
35
+ )
36
+ else
37
+ config
38
+ end
39
+
40
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
41
+ .base_uri_executor(@config.method(:get_base_uri))
42
+ .global_errors(BaseController::GLOBAL_ERRORS)
43
+ .user_agent(BaseController.user_agent)
44
+
45
+ initialize_auth_managers(@global_configuration)
46
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
47
+ end
48
+
49
+ # Initializes the auth managers hash used for authenticating API calls.
50
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
51
+ def initialize_auth_managers(global_config)
52
+ @auth_managers = {}
53
+ http_client_config = global_config.client_configuration
54
+ %w[RapidAPI-Key].each { |auth| @auth_managers[auth] = nil }
55
+ @auth_managers['RapidAPI-Key'] = CustomHeaderAuthentication.new(
56
+ http_client_config.custom_header_authentication_credentials
57
+ )
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,127 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ ENVIRONMENT = [
10
+ PRODUCTION = 'production'.freeze
11
+ ].freeze
12
+ end
13
+
14
+ # An enum for API servers.
15
+ class Server
16
+ SERVER = [
17
+ DEFAULT = 'default'.freeze
18
+ ].freeze
19
+ end
20
+
21
+ # All configuration including auth info and base URI for the API access
22
+ # are configured in this class.
23
+ class Configuration < CoreLibrary::HttpClientConfiguration
24
+ def x_rapid_api_key
25
+ @custom_header_authentication_credentials.x_rapid_api_key
26
+ end
27
+
28
+ # The attribute readers for properties.
29
+ attr_reader :environment, :custom_header_authentication_credentials
30
+
31
+ class << self
32
+ attr_reader :environments
33
+ end
34
+
35
+ def initialize(
36
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
37
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
38
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
39
+ retry_methods: %i[get put], http_callback: nil,
40
+ environment: Environment::PRODUCTION, x_rapid_api_key: nil,
41
+ custom_header_authentication_credentials: nil
42
+ )
43
+
44
+ super connection: connection, adapter: adapter, timeout: timeout,
45
+ max_retries: max_retries, retry_interval: retry_interval,
46
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
47
+ retry_methods: retry_methods, http_callback: http_callback
48
+
49
+ # Current API environment
50
+ @environment = String(environment)
51
+
52
+ # This is an API key from RapidAPI.
53
+ @x_rapid_api_key = x_rapid_api_key
54
+
55
+ # Initializing Custom Header Signature credentials with the provided auth parameters
56
+ @custom_header_authentication_credentials = create_auth_credentials_object(
57
+ x_rapid_api_key, custom_header_authentication_credentials
58
+ )
59
+
60
+ # The Http Client to use for making requests.
61
+ set_http_client CoreLibrary::FaradayClient.new(self)
62
+ end
63
+
64
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
65
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
66
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
67
+ environment: nil, x_rapid_api_key: nil,
68
+ custom_header_authentication_credentials: nil)
69
+ connection ||= self.connection
70
+ adapter ||= self.adapter
71
+ timeout ||= self.timeout
72
+ max_retries ||= self.max_retries
73
+ retry_interval ||= self.retry_interval
74
+ backoff_factor ||= self.backoff_factor
75
+ retry_statuses ||= self.retry_statuses
76
+ retry_methods ||= self.retry_methods
77
+ http_callback ||= self.http_callback
78
+ environment ||= self.environment
79
+ custom_header_authentication_credentials = create_auth_credentials_object(
80
+ x_rapid_api_key,
81
+ custom_header_authentication_credentials || self.custom_header_authentication_credentials
82
+ )
83
+
84
+ Configuration.new(
85
+ connection: connection, adapter: adapter, timeout: timeout,
86
+ max_retries: max_retries, retry_interval: retry_interval,
87
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
88
+ retry_methods: retry_methods, http_callback: http_callback,
89
+ environment: environment,
90
+ custom_header_authentication_credentials: custom_header_authentication_credentials
91
+ )
92
+ end
93
+
94
+ def create_auth_credentials_object(x_rapid_api_key,
95
+ custom_header_authentication_credentials)
96
+ return custom_header_authentication_credentials if x_rapid_api_key.nil?
97
+
98
+ warn('The \'x_rapid_api_key\' params are deprecated. Use \'custom_header'\
99
+ '_authentication_credentials\' param instead.')
100
+
101
+ unless custom_header_authentication_credentials.nil?
102
+ return custom_header_authentication_credentials.clone_with(
103
+ x_rapid_api_key: x_rapid_api_key
104
+ )
105
+ end
106
+
107
+ CustomHeaderAuthenticationCredentials.new(
108
+ x_rapid_api_key: x_rapid_api_key
109
+ )
110
+ end
111
+
112
+ # All the environments the SDK can run in.
113
+ ENVIRONMENTS = {
114
+ Environment::PRODUCTION => {
115
+ Server::DEFAULT => 'https://wordsapiv1.p.rapidapi.com'
116
+ }
117
+ }.freeze
118
+
119
+ # Generates the appropriate base URI for the environment and the server.
120
+ # @param [Configuration::Server] server The server enum for which the base URI is
121
+ # required.
122
+ # @return [String] The base URI.
123
+ def get_base_uri(server = Server::DEFAULT)
124
+ ENVIRONMENTS[environment][server].clone
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,134 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # APIsController
8
+ class APIsController < BaseController
9
+ # Get synonyms of a word.
10
+ # @param [String] word Required parameter: The word to search synonyms
11
+ # for.
12
+ # @return [SynonymsResponse] response from the API call.
13
+ def synonyms(word)
14
+ new_api_call_builder
15
+ .request(new_request_builder(HttpMethodEnum::GET,
16
+ '/words/{word}/synonyms',
17
+ Server::DEFAULT)
18
+ .template_param(new_parameter(word, key: 'word')
19
+ .should_encode(true))
20
+ .header_param(new_parameter('application/json', key: 'accept'))
21
+ .auth(Single.new('RapidAPI-Key')))
22
+ .response(new_response_handler
23
+ .deserializer(APIHelper.method(:custom_type_deserializer))
24
+ .deserialize_into(SynonymsResponse.method(:from_hash)))
25
+ .execute
26
+ end
27
+
28
+ # Get definitions of a word, including the part of speech.
29
+ # @param [String] word Required parameter: The word to search the
30
+ # definitions for.
31
+ # @return [DefinitionsResponse] response from the API call.
32
+ def definitions(word)
33
+ new_api_call_builder
34
+ .request(new_request_builder(HttpMethodEnum::GET,
35
+ '/words/{word}/definitions',
36
+ Server::DEFAULT)
37
+ .template_param(new_parameter(word, key: 'word')
38
+ .should_encode(true))
39
+ .header_param(new_parameter('application/json', key: 'accept'))
40
+ .auth(Single.new('RapidAPI-Key')))
41
+ .response(new_response_handler
42
+ .deserializer(APIHelper.method(:custom_type_deserializer))
43
+ .deserialize_into(DefinitionsResponse.method(:from_hash)))
44
+ .execute
45
+ end
46
+
47
+ # How to pronounce a word, according to the International Phonetic Alphabet.
48
+ # May include multiple results if the word is pronounced differently
49
+ # depending on its part of speech.
50
+ # @param [String] word Required parameter: The word to search pronunciation
51
+ # for.
52
+ # @return [PronunciationResponse] response from the API call.
53
+ def pronunciation(word)
54
+ new_api_call_builder
55
+ .request(new_request_builder(HttpMethodEnum::GET,
56
+ '/words/{word}/pronunciation',
57
+ Server::DEFAULT)
58
+ .template_param(new_parameter(word, key: 'word')
59
+ .should_encode(true))
60
+ .header_param(new_parameter('application/json', key: 'accept'))
61
+ .auth(Single.new('RapidAPI-Key')))
62
+ .response(new_response_handler
63
+ .deserializer(APIHelper.method(:custom_type_deserializer))
64
+ .deserialize_into(PronunciationResponse.method(:from_hash)))
65
+ .execute
66
+ end
67
+
68
+ # Retrieve information about a word. Results can include definitions, part
69
+ # of speech, synonyms, related words, syllables, and pronunciation. This
70
+ # method is useful to see which relationships are attached to which
71
+ # definition and part of speech of a word.
72
+ # @param [String] word Required parameter: This is a template parameter that
73
+ # is used to provide the word, about which the information is being
74
+ # fetched.
75
+ # @return [WordResponse] response from the API call.
76
+ def word(word)
77
+ new_api_call_builder
78
+ .request(new_request_builder(HttpMethodEnum::GET,
79
+ '/words/{word}',
80
+ Server::DEFAULT)
81
+ .template_param(new_parameter(word, key: 'word')
82
+ .should_encode(true))
83
+ .header_param(new_parameter('application/json', key: 'accept'))
84
+ .auth(Single.new('RapidAPI-Key')))
85
+ .response(new_response_handler
86
+ .deserializer(APIHelper.method(:custom_type_deserializer))
87
+ .deserialize_into(WordResponse.method(:from_hash)))
88
+ .execute
89
+ end
90
+
91
+ # Get examples of how the word is used.
92
+ # @param [String] word Required parameter: The word to search the examples
93
+ # for.
94
+ # @return [ExamplesResponse] response from the API call.
95
+ def examples(word)
96
+ new_api_call_builder
97
+ .request(new_request_builder(HttpMethodEnum::GET,
98
+ '/words/{word}/examples',
99
+ Server::DEFAULT)
100
+ .template_param(new_parameter(word, key: 'word')
101
+ .should_encode(true))
102
+ .header_param(new_parameter('application/json', key: 'accept'))
103
+ .auth(Single.new('RapidAPI-Key')))
104
+ .response(new_response_handler
105
+ .deserializer(APIHelper.method(:custom_type_deserializer))
106
+ .deserialize_into(ExamplesResponse.method(:from_hash)))
107
+ .execute
108
+ end
109
+
110
+ # Expands upon the frequency score returned by the main /words/{word}
111
+ # endpoint. Returns zipf, a score indicating how common the word is in the
112
+ # English language, with a range of 1 to 7; per Million, the number of times
113
+ # the word is likely to appear in a corpus of one million English words; and
114
+ # diversity, a 0-1 scale the shows the likelihood of the word appearing in
115
+ # an English document that is part of a corpus.
116
+ # @param [String] word Required parameter: The word to search frequency
117
+ # for.
118
+ # @return [FrequencyResponse] response from the API call.
119
+ def frequency(word)
120
+ new_api_call_builder
121
+ .request(new_request_builder(HttpMethodEnum::GET,
122
+ '/words/{word}/frequency',
123
+ Server::DEFAULT)
124
+ .template_param(new_parameter(word, key: 'word')
125
+ .should_encode(true))
126
+ .header_param(new_parameter('application/json', key: 'accept'))
127
+ .auth(Single.new('RapidAPI-Key')))
128
+ .response(new_response_handler
129
+ .deserializer(APIHelper.method(:custom_type_deserializer))
130
+ .deserialize_into(FrequencyResponse.method(:from_hash)))
131
+ .execute
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,66 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # BaseController.
8
+ class BaseController
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'APIMATIC 3.0'
14
+ end
15
+
16
+
17
+ GLOBAL_ERRORS = {
18
+ 'default' => ErrorCase.new
19
+ .error_message('HTTP response not OK.')
20
+ .exception_type(APIException)
21
+ }.freeze
22
+
23
+ # Initialization constructor.
24
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
25
+ def initialize(global_configuration)
26
+ @global_configuration = global_configuration
27
+ @config = @global_configuration.client_configuration
28
+ @http_call_back = @config.http_callback
29
+ @api_call = ApiCall.new(@global_configuration)
30
+ end
31
+
32
+ # Creates a new builder for the Api Call instance.
33
+ # @return [ApiCall] The instance of ApiCall.
34
+ def new_api_call_builder
35
+ @api_call.new_builder
36
+ end
37
+
38
+ # Creates a new instance of the request builder.
39
+ # @param [String] http_method The HTTP method to use in the request.
40
+ # @param [String] path The endpoint path to use in the request.
41
+ # @param [String] server The server to extract the base uri for the request.
42
+ # @return [RequestBuilder] The instance of RequestBuilder.
43
+ def new_request_builder(http_method, path, server)
44
+ RequestBuilder.new
45
+ .http_method(http_method)
46
+ .path(path)
47
+ .server(server)
48
+ end
49
+
50
+ # Creates a new instance of the response handler.
51
+ # @return [ResponseHandler] The instance of ResponseHandler.
52
+ def new_response_handler
53
+ ResponseHandler.new
54
+ end
55
+
56
+ # Creates a new instance of the parameter.
57
+ # @param [String|optional] key The key of the parameter.
58
+ # @param [Object] value The value of the parameter.
59
+ # @return [Parameter] The instance of Parameter.
60
+ def new_parameter(value, key: nil)
61
+ Parameter.new
62
+ .key(key)
63
+ .value(value)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,10 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # Class for exceptions when there is a network error, status code error, etc.
8
+ class APIException < CoreLibrary::ApiException
9
+ end
10
+ end
@@ -0,0 +1,44 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # Utility class for custom header authorization.
8
+ class CustomHeaderAuthentication < CoreLibrary::HeaderAuth
9
+ # Display error message on occurrence of authentication failure.
10
+ # @returns [String] The oAuth error message.
11
+ def error_message
12
+ 'CustomHeaderAuthentication: x_rapid_api_key is undefined.'
13
+ end
14
+
15
+ # Initialization constructor.
16
+ def initialize(custom_header_authentication_credentials)
17
+ auth_params = {}
18
+ auth_params['X-RapidAPI-Key'] = custom_header_authentication_credentials.x_rapid_api_key unless
19
+ custom_header_authentication_credentials.nil? || custom_header_authentication_credentials.x_rapid_api_key.nil?
20
+
21
+ super auth_params
22
+ end
23
+ end
24
+
25
+ # Data class for CustomHeaderAuthenticationCredentials.
26
+ # Data class for CustomHeaderAuthenticationCredentials.
27
+ class CustomHeaderAuthenticationCredentials
28
+ attr_reader :x_rapid_api_key
29
+
30
+ def initialize(x_rapid_api_key:)
31
+ raise ArgumentError, 'x_rapid_api_key cannot be nil' if x_rapid_api_key.nil?
32
+
33
+ @x_rapid_api_key = x_rapid_api_key
34
+ end
35
+
36
+ def clone_with(x_rapid_api_key: nil)
37
+ x_rapid_api_key ||= self.x_rapid_api_key
38
+
39
+ CustomHeaderAuthenticationCredentials.new(
40
+ x_rapid_api_key: x_rapid_api_key
41
+ )
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # HttpCallBack allows defining callables for pre and post API calls.
8
+ class HttpCallBack < CoreLibrary::HttpCallback
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,62 @@
1
+ # words_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WordsApi
7
+ # Base model.
8
+ class BaseModel < CoreLibrary::BaseModel
9
+ # Returns a Hash representation of the current object.
10
+ def to_hash
11
+ # validating the model being serialized
12
+ self.class.validate(self) if self.class.respond_to?(:validate)
13
+
14
+ hash = {}
15
+ instance_variables.each do |name|
16
+ value = instance_variable_get(name)
17
+ name = name[1..]
18
+ key = self.class.names.key?(name) ? self.class.names[name] : name
19
+ optional_fields = self.class.optionals
20
+ nullable_fields = self.class.nullables
21
+ if value.nil?
22
+ next unless nullable_fields.include?(name)
23
+
24
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
25
+ raise ArgumentError,
26
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
27
+ end
28
+ end
29
+
30
+ hash[key] = nil
31
+ unless value.nil?
32
+ if respond_to?("to_custom_#{name}")
33
+ if (value.instance_of? Array) || (value.instance_of? Hash)
34
+ params = [hash, key]
35
+ hash[key] = send("to_custom_#{name}", *params)
36
+ else
37
+ hash[key] = send("to_custom_#{name}")
38
+ end
39
+ elsif respond_to?("to_union_type_#{name}")
40
+ hash[key] = send("to_union_type_#{name}")
41
+ elsif value.instance_of? Array
42
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
43
+ elsif value.instance_of? Hash
44
+ hash[key] = {}
45
+ value.each do |k, v|
46
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
47
+ end
48
+ else
49
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
50
+ end
51
+ end
52
+ end
53
+ hash
54
+ end
55
+
56
+ # Returns a JSON representation of the curent object.
57
+ def to_json(options = {})
58
+ hash = to_hash
59
+ hash.to_json(options)
60
+ end
61
+ end
62
+ end