Skip to content

Commit

Permalink
Update with latest OpenAPI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
moneykitt committed May 2, 2024
1 parent b73b39a commit 0c92738
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 42 deletions.
9 changes: 3 additions & 6 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ docs/RequestedLinkPermission.md
docs/Response401DisconnectLinksIdDelete.md
docs/Response401ExchangeTokenLinkSessionExchangeTokenPost.md
docs/Response401GetAccountLinksIdAccountsAccountIdGet.md
docs/Response401GetAccountNumbersLegacy20230218LinksIdAccountsNumbersGet.md
docs/Response401GetAccountNumbers.md
docs/Response401GetAccountsLinksIdAccountsGet.md
docs/Response401GetHoldingsLinksIdInvestmentsHoldingsGet.md
docs/Response401GetIdentitiesLinksIdIdentityGet.md
Expand Down Expand Up @@ -227,7 +227,7 @@ lib/moneykit/models/requested_link_permission.rb
lib/moneykit/models/response401_disconnect_links_id_delete.rb
lib/moneykit/models/response401_exchange_token_link_session_exchange_token_post.rb
lib/moneykit/models/response401_get_account_links_id_accounts_account_id_get.rb
lib/moneykit/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get.rb
lib/moneykit/models/response401_get_account_numbers.rb
lib/moneykit/models/response401_get_accounts_links_id_accounts_get.rb
lib/moneykit/models/response401_get_holdings_links_id_investments_holdings_get.rb
lib/moneykit/models/response401_get_identities_links_id_identity_get.rb
Expand Down Expand Up @@ -266,8 +266,5 @@ lib/moneykit/version.rb
moneykit.gemspec
spec/api_client_spec.rb
spec/configuration_spec.rb
spec/models/account_numbers_legacy20230218_spec.rb
spec/models/account_with_account_numbers_legacy20230218_spec.rb
spec/models/get_account_numbers_response_legacy20230218_spec.rb
spec/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get_spec.rb
spec/models/response401_get_account_numbers_spec.rb
spec/spec_helper.rb
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
moneykit (0.1.9)
moneykit (0.1.10)
faraday (>= 1.0.1, < 3.0)
faraday-multipart

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bundle add moneykit.gemspec
or add the following to your `Gemfile`

```
gem 'moneykit', '~> 0.1.9'
gem 'moneykit', '~> 0.1.10'
```

## Getting Started
Expand Down
18 changes: 9 additions & 9 deletions docs/AccountNumbersApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ All URIs are relative to *https://api.moneykit.com*

| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**get_account_numbers_legacy20230218**](AccountNumbersApi.md#get_account_numbers_legacy20230218) | **GET** /links/{id}/accounts/numbers | /links/{id}/accounts/numbers |
| [**get_account_numbers**](AccountNumbersApi.md#get_account_numbers) | **GET** /links/{id}/accounts/numbers | /links/{id}/accounts/numbers |


## get_account_numbers_legacy20230218
## get_account_numbers

> <GetAccountNumbersResponseLegacy20230218> get_account_numbers_legacy20230218(id)
> <GetAccountNumbersResponseLegacy20230218> get_account_numbers(id)
/links/{id}/accounts/numbers

Expand All @@ -31,28 +31,28 @@ id = 'id_example' # String | The unique ID for this link.

begin
# /links/{id}/accounts/numbers
result = api_instance.get_account_numbers_legacy20230218(id)
result = api_instance.get_account_numbers(id)
p result
rescue MoneyKit::ApiError => e
puts "Error when calling AccountNumbersApi->get_account_numbers_legacy20230218: #{e}"
puts "Error when calling AccountNumbersApi->get_account_numbers: #{e}"
end
```

#### Using the get_account_numbers_legacy20230218_with_http_info variant
#### Using the get_account_numbers_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<GetAccountNumbersResponseLegacy20230218>, Integer, Hash)> get_account_numbers_legacy20230218_with_http_info(id)
> <Array(<GetAccountNumbersResponseLegacy20230218>, Integer, Hash)> get_account_numbers_with_http_info(id)
```ruby
begin
# /links/{id}/accounts/numbers
data, status_code, headers = api_instance.get_account_numbers_legacy20230218_with_http_info(id)
data, status_code, headers = api_instance.get_account_numbers_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => <GetAccountNumbersResponseLegacy20230218>
rescue MoneyKit::ApiError => e
puts "Error when calling AccountNumbersApi->get_account_numbers_legacy20230218_with_http_info: #{e}"
puts "Error when calling AccountNumbersApi->get_account_numbers_with_http_info: #{e}"
end
```

Expand Down
18 changes: 9 additions & 9 deletions docs/AccountsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All URIs are relative to *https://api.moneykit.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**get_account**](AccountsApi.md#get_account) | **GET** /links/{id}/accounts/{account_id} | /links/{id}/accounts/{account_id} |
| [**get_account_numbers_legacy20230218**](AccountsApi.md#get_account_numbers_legacy20230218) | **GET** /links/{id}/accounts/numbers | /links/{id}/accounts/numbers |
| [**get_account_numbers**](AccountsApi.md#get_account_numbers) | **GET** /links/{id}/accounts/numbers | /links/{id}/accounts/numbers |
| [**get_accounts**](AccountsApi.md#get_accounts) | **GET** /links/{id}/accounts | /links/{id}/accounts |
| [**get_user_accounts**](AccountsApi.md#get_user_accounts) | **GET** /users/{id}/accounts | /users/{id}/accounts |

Expand Down Expand Up @@ -81,9 +81,9 @@ end
- **Accept**: application/json


## get_account_numbers_legacy20230218
## get_account_numbers

> <GetAccountNumbersResponseLegacy20230218> get_account_numbers_legacy20230218(id)
> <GetAccountNumbersResponseLegacy20230218> get_account_numbers(id)
/links/{id}/accounts/numbers

Expand All @@ -105,28 +105,28 @@ id = 'id_example' # String | The unique ID for this link.

begin
# /links/{id}/accounts/numbers
result = api_instance.get_account_numbers_legacy20230218(id)
result = api_instance.get_account_numbers(id)
p result
rescue MoneyKit::ApiError => e
puts "Error when calling AccountsApi->get_account_numbers_legacy20230218: #{e}"
puts "Error when calling AccountsApi->get_account_numbers: #{e}"
end
```

#### Using the get_account_numbers_legacy20230218_with_http_info variant
#### Using the get_account_numbers_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<GetAccountNumbersResponseLegacy20230218>, Integer, Hash)> get_account_numbers_legacy20230218_with_http_info(id)
> <Array(<GetAccountNumbersResponseLegacy20230218>, Integer, Hash)> get_account_numbers_with_http_info(id)
```ruby
begin
# /links/{id}/accounts/numbers
data, status_code, headers = api_instance.get_account_numbers_legacy20230218_with_http_info(id)
data, status_code, headers = api_instance.get_account_numbers_with_http_info(id)
p status_code # => 2xx
p headers # => { ... }
p data # => <GetAccountNumbersResponseLegacy20230218>
rescue MoneyKit::ApiError => e
puts "Error when calling AccountsApi->get_account_numbers_legacy20230218_with_http_info: #{e}"
puts "Error when calling AccountsApi->get_account_numbers_with_http_info: #{e}"
end
```

Expand Down
22 changes: 22 additions & 0 deletions docs/Response401GetAccountNumbers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# MoneyKit::Response401GetAccountNumbers

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **error_code** | **Object** | | [optional] |
| **error_message** | **Object** | | |
| **documentation_url** | **Object** | | [optional] |

## Example

```ruby
require 'moneykit'

instance = MoneyKit::Response401GetAccountNumbers.new(
error_code: null,
error_message: null,
documentation_url: null
)
```

2 changes: 1 addition & 1 deletion lib/moneykit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
require 'moneykit/models/response401_disconnect_links_id_delete'
require 'moneykit/models/response401_exchange_token_link_session_exchange_token_post'
require 'moneykit/models/response401_get_account_links_id_accounts_account_id_get'
require 'moneykit/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get'
require 'moneykit/models/response401_get_account_numbers'
require 'moneykit/models/response401_get_accounts_links_id_accounts_get'
require 'moneykit/models/response401_get_holdings_links_id_investments_holdings_get'
require 'moneykit/models/response401_get_identities_links_id_identity_get'
Expand Down
14 changes: 7 additions & 7 deletions lib/moneykit/api/account_numbers_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def initialize(api_client = ApiClient.default)
# @param id [String] The unique ID for this link.
# @param [Hash] opts the optional parameters
# @return [GetAccountNumbersResponseLegacy20230218]
def get_account_numbers_legacy20230218(id, opts = {})
data, _status_code, _headers = get_account_numbers_legacy20230218_with_http_info(id, opts)
def get_account_numbers(id, opts = {})
data, _status_code, _headers = get_account_numbers_with_http_info(id, opts)
data
end

Expand All @@ -34,13 +34,13 @@ def get_account_numbers_legacy20230218(id, opts = {})
# @param id [String] The unique ID for this link.
# @param [Hash] opts the optional parameters
# @return [Array<(GetAccountNumbersResponseLegacy20230218, Integer, Hash)>] GetAccountNumbersResponseLegacy20230218 data, response status code and response headers
def get_account_numbers_legacy20230218_with_http_info(id, opts = {})
def get_account_numbers_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountNumbersApi.get_account_numbers_legacy20230218 ...'
@api_client.config.logger.debug 'Calling API: AccountNumbersApi.get_account_numbers ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling AccountNumbersApi.get_account_numbers_legacy20230218"
fail ArgumentError, "Missing the required parameter 'id' when calling AccountNumbersApi.get_account_numbers"
end
# resource path
local_var_path = '/links/{id}/accounts/numbers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
Expand All @@ -66,7 +66,7 @@ def get_account_numbers_legacy20230218_with_http_info(id, opts = {})
auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']

new_options = opts.merge(
:operation => :"AccountNumbersApi.get_account_numbers_legacy20230218",
:operation => :"AccountNumbersApi.get_account_numbers",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
Expand All @@ -77,7 +77,7 @@ def get_account_numbers_legacy20230218_with_http_info(id, opts = {})

data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AccountNumbersApi#get_account_numbers_legacy20230218\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
@api_client.config.logger.debug "API called: AccountNumbersApi#get_account_numbers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
Expand Down
14 changes: 7 additions & 7 deletions lib/moneykit/api/accounts_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def get_account_with_http_info(id, account_id, opts = {})
# @param id [String] The unique ID for this link.
# @param [Hash] opts the optional parameters
# @return [GetAccountNumbersResponseLegacy20230218]
def get_account_numbers_legacy20230218(id, opts = {})
data, _status_code, _headers = get_account_numbers_legacy20230218_with_http_info(id, opts)
def get_account_numbers(id, opts = {})
data, _status_code, _headers = get_account_numbers_with_http_info(id, opts)
data
end

Expand All @@ -103,13 +103,13 @@ def get_account_numbers_legacy20230218(id, opts = {})
# @param id [String] The unique ID for this link.
# @param [Hash] opts the optional parameters
# @return [Array<(GetAccountNumbersResponseLegacy20230218, Integer, Hash)>] GetAccountNumbersResponseLegacy20230218 data, response status code and response headers
def get_account_numbers_legacy20230218_with_http_info(id, opts = {})
def get_account_numbers_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountsApi.get_account_numbers_legacy20230218 ...'
@api_client.config.logger.debug 'Calling API: AccountsApi.get_account_numbers ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.get_account_numbers_legacy20230218"
fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.get_account_numbers"
end
# resource path
local_var_path = '/links/{id}/accounts/numbers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
Expand All @@ -135,7 +135,7 @@ def get_account_numbers_legacy20230218_with_http_info(id, opts = {})
auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']

new_options = opts.merge(
:operation => :"AccountsApi.get_account_numbers_legacy20230218",
:operation => :"AccountsApi.get_account_numbers",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
Expand All @@ -146,7 +146,7 @@ def get_account_numbers_legacy20230218_with_http_info(id, opts = {})

data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AccountsApi#get_account_numbers_legacy20230218\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
@api_client.config.logger.debug "API called: AccountsApi#get_account_numbers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
Expand Down
104 changes: 104 additions & 0 deletions lib/moneykit/models/response401_get_account_numbers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
=begin
#MoneyKit API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2023-02-18
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.1.0
=end

require 'date'
require 'time'

module MoneyKit
module Response401GetAccountNumbers
class << self
# List of class defined in anyOf (OpenAPI v3)
def openapi_any_of
[
:'APIErrorAuthExpiredAccessTokenResponse',
:'APIErrorAuthUnauthorizedResponse',
:'LinkErrorUnauthorizedAccessResponse'
]
end

# Builds the object
# @param [Mixed] Data to be matched against the list of anyOf items
# @return [Object] Returns the model or the data itself
def build(data)
# Go through the list of anyOf items and attempt to identify the appropriate one.
# Note:
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
# - TODO: scalar values are de facto behaving as if they were nullable.
# - TODO: logging when debugging is set.
openapi_any_of.each do |klass|
begin
next if klass == :AnyType # "nullable: true"
typed_data = find_and_cast_into_type(klass, data)
return typed_data if typed_data
rescue # rescue all errors so we keep iterating even if the current item lookup raises
end
end

openapi_any_of.include?(:AnyType) ? data : nil
end

private

SchemaMismatchError = Class.new(StandardError)

# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
def find_and_cast_into_type(klass, data)
return if data.nil?

case klass.to_s
when 'Boolean'
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
when 'Float'
return data if data.instance_of?(Float)
when 'Integer'
return data if data.instance_of?(Integer)
when 'Time'
return Time.parse(data)
when 'Date'
return Date.parse(data)
when 'String'
return data if data.instance_of?(String)
when 'Object' # "type: object"
return data if data.instance_of?(Hash)
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
if data.instance_of?(Array)
sub_type = Regexp.last_match[:sub_type]
return data.map { |item| find_and_cast_into_type(sub_type, item) }
end
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
sub_type = Regexp.last_match[:sub_type]
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
end
else # model
const = MoneyKit.const_get(klass)
if const
if const.respond_to?(:openapi_any_of) # nested anyOf model
model = const.build(data)
return model if model
else
# raise if data contains keys that are not known to the model
raise unless (data.keys - const.acceptable_attributes).empty?
model = const.build_from_hash(data)
return model if model
end
end
end

raise # if no match by now, raise
rescue
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
end
end
end
end
2 changes: 1 addition & 1 deletion lib/moneykit/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module MoneyKit
VERSION = '0.1.9'
VERSION = '0.1.10'
end
Loading

0 comments on commit 0c92738

Please sign in to comment.