cloudmersive-currency-api-client 2.0.1

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 (30) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +111 -0
  4. data/Rakefile +8 -0
  5. data/cloudmersive-currency-api-client.gemspec +45 -0
  6. data/docs/AvailableCurrency.md +14 -0
  7. data/docs/AvailableCurrencyResponse.md +8 -0
  8. data/docs/ConvertedCurrencyResult.md +11 -0
  9. data/docs/CurrencyExchangeApi.md +176 -0
  10. data/docs/ExchangeRateResult.md +8 -0
  11. data/git_push.sh +55 -0
  12. data/lib/cloudmersive-currency-api-client.rb +44 -0
  13. data/lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb +193 -0
  14. data/lib/cloudmersive-currency-api-client/api_client.rb +391 -0
  15. data/lib/cloudmersive-currency-api-client/api_error.rb +38 -0
  16. data/lib/cloudmersive-currency-api-client/configuration.rb +209 -0
  17. data/lib/cloudmersive-currency-api-client/models/available_currency.rb +246 -0
  18. data/lib/cloudmersive-currency-api-client/models/available_currency_response.rb +188 -0
  19. data/lib/cloudmersive-currency-api-client/models/converted_currency_result.rb +216 -0
  20. data/lib/cloudmersive-currency-api-client/models/exchange_rate_result.rb +186 -0
  21. data/lib/cloudmersive-currency-api-client/version.rb +15 -0
  22. data/spec/api/currency_exchange_api_spec.rb +73 -0
  23. data/spec/api_client_spec.rb +243 -0
  24. data/spec/configuration_spec.rb +42 -0
  25. data/spec/models/available_currency_response_spec.rb +41 -0
  26. data/spec/models/available_currency_spec.rb +77 -0
  27. data/spec/models/converted_currency_result_spec.rb +59 -0
  28. data/spec/models/exchange_rate_result_spec.rb +41 -0
  29. data/spec/spec_helper.rb +111 -0
  30. metadata +252 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 563ce9475cac1f10d93304c5a21211632e2808e665f219859f510cbfe61c2590
4
+ data.tar.gz: 3814d04258f24c340e6c78960cdfa415ee55ad2c1a814c85d64137a0812875d0
5
+ SHA512:
6
+ metadata.gz: d6369de3ae64808421e6931621d3e7fae0379bf56b852b709e242255660ab7a5224f766c34ae0f15bf395fee091f2effcce04a17d471c522c7e18fd64975c9c8
7
+ data.tar.gz: a89f9f00e567453b1d97e96d5da9d990625136282be8429e8a16ea27def7bde7fb6b1ac44567b0cd6f4447d812436e7092ef0aadfc0e7f410a473d65c701c59e
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 12.3.3'
7
+ end
@@ -0,0 +1,111 @@
1
+ # cloudmersive-currency-api-client
2
+
3
+ CloudmersiveCurrencyApiClient - the Ruby gem for the currencyapi
4
+
5
+ The currency APIs help you retrieve exchange rates and convert prices between currencies easily.
6
+
7
+ This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
+
9
+ - API version: v1
10
+ - Package version: 2.0.1
11
+ - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
+
13
+ ## Installation
14
+
15
+ ### Build a gem
16
+
17
+ To build the Ruby code into a gem:
18
+
19
+ ```shell
20
+ gem build cloudmersive-currency-api-client.gemspec
21
+ ```
22
+
23
+ Then either install the gem locally:
24
+
25
+ ```shell
26
+ gem install ./cloudmersive-currency-api-client-2.0.1.gem
27
+ ```
28
+ (for development, run `gem install --dev ./cloudmersive-currency-api-client-2.0.1.gem` to install the development dependencies)
29
+
30
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
31
+
32
+ Finally add this to the Gemfile:
33
+
34
+ gem 'cloudmersive-currency-api-client', '~> 2.0.1'
35
+
36
+ ### Install from Git
37
+
38
+ If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
39
+
40
+ gem 'cloudmersive-currency-api-client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
41
+
42
+ ### Include the Ruby code directly
43
+
44
+ Include the Ruby code directly using `-I` as follows:
45
+
46
+ ```shell
47
+ ruby -Ilib script.rb
48
+ ```
49
+
50
+ ## Getting Started
51
+
52
+ Please follow the [installation](#installation) procedure and then run the following code:
53
+ ```ruby
54
+ # Load the gem
55
+ require 'cloudmersive-currency-api-client'
56
+
57
+ # Setup authorization
58
+ CloudmersiveCurrencyApiClient.configure do |config|
59
+ # Configure API key authorization: Apikey
60
+ config.api_key['Apikey'] = 'YOUR API KEY'
61
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
62
+ #config.api_key_prefix['Apikey'] = 'Bearer'
63
+ end
64
+
65
+ api_instance = CloudmersiveCurrencyApiClient::CurrencyExchangeApi.new
66
+
67
+ source = 'source_example' # String | Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
68
+
69
+ destination = 'destination_example' # String | Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
70
+
71
+ source_price = 1.2 # Float | Input price, such as 19.99 in source currency
72
+
73
+
74
+ begin
75
+ #Converts a price from the source currency into the destination currency
76
+ result = api_instance.currency_exchange_convert_currency(source, destination, source_price)
77
+ p result
78
+ rescue CloudmersiveCurrencyApiClient::ApiError => e
79
+ puts "Exception when calling CurrencyExchangeApi->currency_exchange_convert_currency: #{e}"
80
+ end
81
+
82
+ ```
83
+
84
+ ## Documentation for API Endpoints
85
+
86
+ All URIs are relative to *https://api.cloudmersive.com*
87
+
88
+ Class | Method | HTTP request | Description
89
+ ------------ | ------------- | ------------- | -------------
90
+ *CloudmersiveCurrencyApiClient::CurrencyExchangeApi* | [**currency_exchange_convert_currency**](docs/CurrencyExchangeApi.md#currency_exchange_convert_currency) | **POST** /currency/exchange-rates/convert/{source}/to/{destination} | Converts a price from the source currency into the destination currency
91
+ *CloudmersiveCurrencyApiClient::CurrencyExchangeApi* | [**currency_exchange_get_available_currencies**](docs/CurrencyExchangeApi.md#currency_exchange_get_available_currencies) | **POST** /currency/exchange-rates/list-available | Get a list of available currencies and corresponding countries
92
+ *CloudmersiveCurrencyApiClient::CurrencyExchangeApi* | [**currency_exchange_get_exchange_rate**](docs/CurrencyExchangeApi.md#currency_exchange_get_exchange_rate) | **POST** /currency/exchange-rates/get/{source}/to/{destination} | Gets the exchange rate from the source currency into the destination currency
93
+
94
+
95
+ ## Documentation for Models
96
+
97
+ - [CloudmersiveCurrencyApiClient::AvailableCurrency](docs/AvailableCurrency.md)
98
+ - [CloudmersiveCurrencyApiClient::AvailableCurrencyResponse](docs/AvailableCurrencyResponse.md)
99
+ - [CloudmersiveCurrencyApiClient::ConvertedCurrencyResult](docs/ConvertedCurrencyResult.md)
100
+ - [CloudmersiveCurrencyApiClient::ExchangeRateResult](docs/ExchangeRateResult.md)
101
+
102
+
103
+ ## Documentation for Authorization
104
+
105
+
106
+ ### Apikey
107
+
108
+ - **Type**: API key
109
+ - **API key parameter name**: Apikey
110
+ - **Location**: HTTP header
111
+
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
6
+ rescue LoadError
7
+ # no rspec available
8
+ end
@@ -0,0 +1,45 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ #currencyapi
5
+
6
+ #The currency APIs help you retrieve exchange rates and convert prices between currencies easily.
7
+
8
+ OpenAPI spec version: v1
9
+
10
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
11
+ Swagger Codegen version: 2.4.14
12
+
13
+ =end
14
+
15
+ $:.push File.expand_path("../lib", __FILE__)
16
+ require "cloudmersive-currency-api-client/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "cloudmersive-currency-api-client"
20
+ s.version = CloudmersiveCurrencyApiClient::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = ["Cloudmersive"]
23
+ s.email = [""]
24
+ s.homepage = "https://www.cloudmersive.com/currency-api"
25
+ s.summary = "Manage currency exchange rates and convert prices between currencies."
26
+ s.description = "The currency APIs help you work with currency data. Convert prices between currencies and retrieve exchange rates."
27
+ s.license = 'Apache 2.0'
28
+ s.required_ruby_version = ">= 1.9"
29
+
30
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
+ s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
32
+
33
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
+ s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
35
+ s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
36
+ s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
37
+ s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
38
+ s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
39
+ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
40
+
41
+ s.files = Dir['./**/*']
42
+ s.test_files = `find spec/*`.split("\n")
43
+ s.executables = []
44
+ s.require_paths = ["lib"]
45
+ end
@@ -0,0 +1,14 @@
1
+ # CloudmersiveCurrencyApiClient::AvailableCurrency
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **iso_currency_code** | **String** | ISO 4217 currency three-letter code associated with the country | [optional]
7
+ **currency_symbol** | **String** | Symbol associated with the currency | [optional]
8
+ **currency_english_name** | **String** | Full name of the currency | [optional]
9
+ **country_name** | **String** | Name of the country | [optional]
10
+ **country_three_letter_code** | **String** | Three-letter ISO 3166-1 country code | [optional]
11
+ **country_iso_two_letter_code** | **String** | Two-letter ISO 3166-1 country code | [optional]
12
+ **is_european_union_member** | **BOOLEAN** | True if this country is currently a member of the European Union (EU), false otherwise | [optional]
13
+
14
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveCurrencyApiClient::AvailableCurrencyResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **currencies** | [**Array<AvailableCurrency>**](AvailableCurrency.md) | List of available currencies from the API | [optional]
7
+
8
+
@@ -0,0 +1,11 @@
1
+ # CloudmersiveCurrencyApiClient::ConvertedCurrencyResult
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **converted_price** | **Float** | The converted price in the destination currency | [optional]
7
+ **iso_currency_code** | **String** | ISO 4217 currency three-letter code of destination price | [optional]
8
+ **currency_symbol** | **String** | Destination currency symbol | [optional]
9
+ **formatted_price_as_string** | **String** | Formatted price in the destination currency as a string | [optional]
10
+
11
+
@@ -0,0 +1,176 @@
1
+ # CloudmersiveCurrencyApiClient::CurrencyExchangeApi
2
+
3
+ All URIs are relative to *https://api.cloudmersive.com*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**currency_exchange_convert_currency**](CurrencyExchangeApi.md#currency_exchange_convert_currency) | **POST** /currency/exchange-rates/convert/{source}/to/{destination} | Converts a price from the source currency into the destination currency
8
+ [**currency_exchange_get_available_currencies**](CurrencyExchangeApi.md#currency_exchange_get_available_currencies) | **POST** /currency/exchange-rates/list-available | Get a list of available currencies and corresponding countries
9
+ [**currency_exchange_get_exchange_rate**](CurrencyExchangeApi.md#currency_exchange_get_exchange_rate) | **POST** /currency/exchange-rates/get/{source}/to/{destination} | Gets the exchange rate from the source currency into the destination currency
10
+
11
+
12
+ # **currency_exchange_convert_currency**
13
+ > ConvertedCurrencyResult currency_exchange_convert_currency(source, destination, source_price)
14
+
15
+ Converts a price from the source currency into the destination currency
16
+
17
+ Automatically converts the price in the source currency into the destination currency using the latest available currency exchange rate data.
18
+
19
+ ### Example
20
+ ```ruby
21
+ # load the gem
22
+ require 'cloudmersive-currency-api-client'
23
+ # setup authorization
24
+ CloudmersiveCurrencyApiClient.configure do |config|
25
+ # Configure API key authorization: Apikey
26
+ config.api_key['Apikey'] = 'YOUR API KEY'
27
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
28
+ #config.api_key_prefix['Apikey'] = 'Bearer'
29
+ end
30
+
31
+ api_instance = CloudmersiveCurrencyApiClient::CurrencyExchangeApi.new
32
+
33
+ source = 'source_example' # String | Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
34
+
35
+ destination = 'destination_example' # String | Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
36
+
37
+ source_price = 1.2 # Float | Input price, such as 19.99 in source currency
38
+
39
+
40
+ begin
41
+ #Converts a price from the source currency into the destination currency
42
+ result = api_instance.currency_exchange_convert_currency(source, destination, source_price)
43
+ p result
44
+ rescue CloudmersiveCurrencyApiClient::ApiError => e
45
+ puts "Exception when calling CurrencyExchangeApi->currency_exchange_convert_currency: #{e}"
46
+ end
47
+ ```
48
+
49
+ ### Parameters
50
+
51
+ Name | Type | Description | Notes
52
+ ------------- | ------------- | ------------- | -------------
53
+ **source** | **String**| Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc. |
54
+ **destination** | **String**| Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc. |
55
+ **source_price** | **Float**| Input price, such as 19.99 in source currency |
56
+
57
+ ### Return type
58
+
59
+ [**ConvertedCurrencyResult**](ConvertedCurrencyResult.md)
60
+
61
+ ### Authorization
62
+
63
+ [Apikey](../README.md#Apikey)
64
+
65
+ ### HTTP request headers
66
+
67
+ - **Content-Type**: application/json, text/json
68
+ - **Accept**: application/json, text/json, application/xml, text/xml
69
+
70
+
71
+
72
+ # **currency_exchange_get_available_currencies**
73
+ > AvailableCurrencyResponse currency_exchange_get_available_currencies
74
+
75
+ Get a list of available currencies and corresponding countries
76
+
77
+ Enumerates available currencies and the countries that correspond to these currencies.
78
+
79
+ ### Example
80
+ ```ruby
81
+ # load the gem
82
+ require 'cloudmersive-currency-api-client'
83
+ # setup authorization
84
+ CloudmersiveCurrencyApiClient.configure do |config|
85
+ # Configure API key authorization: Apikey
86
+ config.api_key['Apikey'] = 'YOUR API KEY'
87
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
88
+ #config.api_key_prefix['Apikey'] = 'Bearer'
89
+ end
90
+
91
+ api_instance = CloudmersiveCurrencyApiClient::CurrencyExchangeApi.new
92
+
93
+ begin
94
+ #Get a list of available currencies and corresponding countries
95
+ result = api_instance.currency_exchange_get_available_currencies
96
+ p result
97
+ rescue CloudmersiveCurrencyApiClient::ApiError => e
98
+ puts "Exception when calling CurrencyExchangeApi->currency_exchange_get_available_currencies: #{e}"
99
+ end
100
+ ```
101
+
102
+ ### Parameters
103
+ This endpoint does not need any parameter.
104
+
105
+ ### Return type
106
+
107
+ [**AvailableCurrencyResponse**](AvailableCurrencyResponse.md)
108
+
109
+ ### Authorization
110
+
111
+ [Apikey](../README.md#Apikey)
112
+
113
+ ### HTTP request headers
114
+
115
+ - **Content-Type**: Not defined
116
+ - **Accept**: application/json, text/json, application/xml, text/xml
117
+
118
+
119
+
120
+ # **currency_exchange_get_exchange_rate**
121
+ > ExchangeRateResult currency_exchange_get_exchange_rate(source, destination)
122
+
123
+ Gets the exchange rate from the source currency into the destination currency
124
+
125
+ Automatically gets the exchange rate from the source currency into the destination currency using the latest available currency exchange rate data.
126
+
127
+ ### Example
128
+ ```ruby
129
+ # load the gem
130
+ require 'cloudmersive-currency-api-client'
131
+ # setup authorization
132
+ CloudmersiveCurrencyApiClient.configure do |config|
133
+ # Configure API key authorization: Apikey
134
+ config.api_key['Apikey'] = 'YOUR API KEY'
135
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
136
+ #config.api_key_prefix['Apikey'] = 'Bearer'
137
+ end
138
+
139
+ api_instance = CloudmersiveCurrencyApiClient::CurrencyExchangeApi.new
140
+
141
+ source = 'source_example' # String | Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
142
+
143
+ destination = 'destination_example' # String | Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc.
144
+
145
+
146
+ begin
147
+ #Gets the exchange rate from the source currency into the destination currency
148
+ result = api_instance.currency_exchange_get_exchange_rate(source, destination)
149
+ p result
150
+ rescue CloudmersiveCurrencyApiClient::ApiError => e
151
+ puts "Exception when calling CurrencyExchangeApi->currency_exchange_get_exchange_rate: #{e}"
152
+ end
153
+ ```
154
+
155
+ ### Parameters
156
+
157
+ Name | Type | Description | Notes
158
+ ------------- | ------------- | ------------- | -------------
159
+ **source** | **String**| Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc. |
160
+ **destination** | **String**| Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc. |
161
+
162
+ ### Return type
163
+
164
+ [**ExchangeRateResult**](ExchangeRateResult.md)
165
+
166
+ ### Authorization
167
+
168
+ [Apikey](../README.md#Apikey)
169
+
170
+ ### HTTP request headers
171
+
172
+ - **Content-Type**: Not defined
173
+ - **Accept**: application/json, text/json, application/xml, text/xml
174
+
175
+
176
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveCurrencyApiClient::ExchangeRateResult
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **exchange_rate** | **Float** | The exchange rate from the source to the destination currency | [optional]
7
+
8
+
@@ -0,0 +1,55 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
6
+ #
7
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
8
+
9
+ git_user_id=$1
10
+ git_repo_id=$2
11
+ release_note=$3
12
+
13
+ if [ "$git_user_id" = "" ]; then
14
+ git_user_id="GIT_USER_ID"
15
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
16
+ fi
17
+
18
+ if [ "$git_repo_id" = "" ]; then
19
+ git_repo_id="GIT_REPO_ID"
20
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
21
+ fi
22
+
23
+ if [ "$release_note" = "" ]; then
24
+ release_note="Minor update"
25
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
26
+ fi
27
+
28
+ # Initialize the local directory as a Git repository
29
+ git init
30
+
31
+ # Adds the files in the local repository and stages them for commit.
32
+ git add .
33
+
34
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
35
+ git commit -m "$release_note"
36
+
37
+ # Sets the new remote
38
+ git_remote=`git remote`
39
+ if [ "$git_remote" = "" ]; then # git remote not defined
40
+
41
+ if [ "$GIT_TOKEN" = "" ]; then
42
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
43
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
44
+ else
45
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
46
+ fi
47
+
48
+ fi
49
+
50
+ git pull origin master
51
+
52
+ # Pushes (Forces) the changes in the local repository up to the remote repository
53
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
54
+ git push origin master 2>&1 | grep -v 'To https'
55
+