reference_service 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +126 -0
- data/Rakefile +10 -0
- data/docs/ActiveSubscription.md +27 -0
- data/docs/Error.md +17 -0
- data/docs/ErrorErrors.md +17 -0
- data/docs/ErrorErrorsError.md +25 -0
- data/docs/ReportsApi.md +168 -0
- data/docs/Sector.md +19 -0
- data/docs/SectorApi.md +100 -0
- data/docs/SectorSpending.md +23 -0
- data/docs/SpendingReport.md +23 -0
- data/docs/SubscribeApi.md +244 -0
- data/docs/Subscription.md +17 -0
- data/docs/SubscriptionObject.md +27 -0
- data/docs/SubscriptionPaymentCard.md +21 -0
- data/docs/SubscriptionResponse.md +19 -0
- data/docs/TopLocationsReport.md +17 -0
- data/docs/UnsubscribedResponse.md +19 -0
- data/git_push.sh +55 -0
- data/lib/openapi_client.rb +55 -0
- data/lib/openapi_client/api/reports_api.rb +252 -0
- data/lib/openapi_client/api/sector_api.rb +151 -0
- data/lib/openapi_client/api/subscribe_api.rb +334 -0
- data/lib/openapi_client/api_client.rb +386 -0
- data/lib/openapi_client/api_error.rb +57 -0
- data/lib/openapi_client/configuration.rb +244 -0
- data/lib/openapi_client/models/active_subscription.rb +262 -0
- data/lib/openapi_client/models/error.rb +201 -0
- data/lib/openapi_client/models/error_errors.rb +203 -0
- data/lib/openapi_client/models/error_errors_error.rb +232 -0
- data/lib/openapi_client/models/sector.rb +216 -0
- data/lib/openapi_client/models/sector_spending.rb +244 -0
- data/lib/openapi_client/models/spending_report.rb +235 -0
- data/lib/openapi_client/models/subscription.rb +197 -0
- data/lib/openapi_client/models/subscription_object.rb +247 -0
- data/lib/openapi_client/models/subscription_payment_card.rb +254 -0
- data/lib/openapi_client/models/subscription_response.rb +206 -0
- data/lib/openapi_client/models/top_locations_report.rb +200 -0
- data/lib/openapi_client/models/unsubscribed_response.rb +207 -0
- data/lib/openapi_client/version.rb +15 -0
- data/openapi_client.gemspec +38 -0
- data/spec/api/reports_api_spec.rb +77 -0
- data/spec/api/sector_api_spec.rb +58 -0
- data/spec/api/subscribe_api_spec.rb +92 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/active_subscription_spec.rb +71 -0
- data/spec/models/error_errors_error_spec.rb +65 -0
- data/spec/models/error_errors_spec.rb +41 -0
- data/spec/models/error_spec.rb +41 -0
- data/spec/models/sector_spec.rb +47 -0
- data/spec/models/sector_spending_spec.rb +59 -0
- data/spec/models/spending_report_spec.rb +59 -0
- data/spec/models/subscription_object_spec.rb +71 -0
- data/spec/models/subscription_payment_card_spec.rb +53 -0
- data/spec/models/subscription_response_spec.rb +47 -0
- data/spec/models/subscription_spec.rb +41 -0
- data/spec/models/top_locations_report_spec.rb +41 -0
- data/spec/models/unsubscribed_response_spec.rb +47 -0
- data/spec/spec_helper.rb +111 -0
- metadata +199 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# OpenapiClient::SubscriptionPaymentCard
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**card_number** | **Integer** | Credit/Debit card number used for paying for the subscription |
|
8
|
+
**expiry** | **String** | Credit/Debit expiry date used for paying for the subscription |
|
9
|
+
**cvc** | **Integer** | Credit/Debit cvc number used for paying for the subscription |
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'OpenapiClient'
|
15
|
+
|
16
|
+
instance = OpenapiClient::SubscriptionPaymentCard.new(card_number: 5506900140100305,
|
17
|
+
expiry: 01/01,
|
18
|
+
cvc: 123)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# OpenapiClient::SubscriptionResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**message** | **String** | | [optional]
|
8
|
+
**subscription** | [**ActiveSubscription**](ActiveSubscription.md) | | [optional]
|
9
|
+
|
10
|
+
## Code Sample
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'OpenapiClient'
|
14
|
+
|
15
|
+
instance = OpenapiClient::SubscriptionResponse.new(message: Subscription Created,
|
16
|
+
subscription: null)
|
17
|
+
```
|
18
|
+
|
19
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# OpenapiClient::TopLocationsReport
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**locations** | [**Array<SpendingReport>**](SpendingReport.md) | Array of spending reports for the top locations | [optional]
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'OpenapiClient'
|
13
|
+
|
14
|
+
instance = OpenapiClient::TopLocationsReport.new(locations: null)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# OpenapiClient::UnsubscribedResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**subscription_id** | **String** | Unique identifier of the subscription (Version 4 UUID) | [optional]
|
8
|
+
**message** | **String** | | [optional]
|
9
|
+
|
10
|
+
## Code Sample
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'OpenapiClient'
|
14
|
+
|
15
|
+
instance = OpenapiClient::UnsubscribedResponse.new(subscription_id: cb9fa3cc-8a06-39af-b605-934799914275,
|
16
|
+
message: Subscription Cancelled)
|
17
|
+
```
|
18
|
+
|
19
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://openapi-generator.tech
|
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 openapi-pestore-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
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
=begin
|
2
|
+
#Golden Service API
|
3
|
+
|
4
|
+
#An API that conforms to the standards and best practices that should be adhered to in all Mastercard owned APIs. Can be used to create subscriptions to reports that are generated twice daily (6am & 6pm) that deliver e-commerce spending across multiple sectors and locations. <br/> --- * **All requests must be signed using oauth 1.0a. Please refer to: https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/** --- * **The user must provide their card details when creating a subscription. These details must be encrypted before entering transit. Please refer to [Mastercard security](https://stage.developer.mastercard.com/platform/documentation/securing-sensitive-data-using-payload-encryption/)** ---
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.1.0
|
7
|
+
Contact: developers@mastercard.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'openapi_client/api_client'
|
15
|
+
require 'openapi_client/api_error'
|
16
|
+
require 'openapi_client/version'
|
17
|
+
require 'openapi_client/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'openapi_client/models/active_subscription'
|
21
|
+
require 'openapi_client/models/error'
|
22
|
+
require 'openapi_client/models/error_errors'
|
23
|
+
require 'openapi_client/models/error_errors_error'
|
24
|
+
require 'openapi_client/models/sector'
|
25
|
+
require 'openapi_client/models/sector_spending'
|
26
|
+
require 'openapi_client/models/spending_report'
|
27
|
+
require 'openapi_client/models/subscription'
|
28
|
+
require 'openapi_client/models/subscription_object'
|
29
|
+
require 'openapi_client/models/subscription_payment_card'
|
30
|
+
require 'openapi_client/models/subscription_response'
|
31
|
+
require 'openapi_client/models/top_locations_report'
|
32
|
+
require 'openapi_client/models/unsubscribed_response'
|
33
|
+
|
34
|
+
# APIs
|
35
|
+
require 'openapi_client/api/reports_api'
|
36
|
+
require 'openapi_client/api/sector_api'
|
37
|
+
require 'openapi_client/api/subscribe_api'
|
38
|
+
|
39
|
+
module OpenapiClient
|
40
|
+
class << self
|
41
|
+
# Customize default settings for the SDK using block.
|
42
|
+
# OpenapiClient.configure do |config|
|
43
|
+
# config.username = "xxx"
|
44
|
+
# config.password = "xxx"
|
45
|
+
# end
|
46
|
+
# If no block given, return the default Configuration object.
|
47
|
+
def configure
|
48
|
+
if block_given?
|
49
|
+
yield(Configuration.default)
|
50
|
+
else
|
51
|
+
Configuration.default
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,252 @@
|
|
1
|
+
=begin
|
2
|
+
#Golden Service API
|
3
|
+
|
4
|
+
#An API that conforms to the standards and best practices that should be adhered to in all Mastercard owned APIs. Can be used to create subscriptions to reports that are generated twice daily (6am & 6pm) that deliver e-commerce spending across multiple sectors and locations. <br/> --- * **All requests must be signed using oauth 1.0a. Please refer to: https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/** --- * **The user must provide their card details when creating a subscription. These details must be encrypted before entering transit. Please refer to [Mastercard security](https://stage.developer.mastercard.com/platform/documentation/securing-sensitive-data-using-payload-encryption/)** ---
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.1.0
|
7
|
+
Contact: developers@mastercard.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module OpenapiClient
|
16
|
+
class ReportsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Retrieves e-commerce spending for a particular location, sector and date range or single date
|
23
|
+
# @param date [Date] The date for the requested data
|
24
|
+
# @param location [String] The location for which you wish to receive the top-sectors report.
|
25
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @option opts [Integer] :sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call
|
28
|
+
# @return [SpendingReport]
|
29
|
+
def get_spending(date, location, spending_type, opts = {})
|
30
|
+
data, _status_code, _headers = get_spending_with_http_info(date, location, spending_type, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Retrieves e-commerce spending for a particular location, sector and date range or single date
|
35
|
+
# @param date [Date] The date for the requested data
|
36
|
+
# @param location [String] The location for which you wish to receive the top-sectors report.
|
37
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @option opts [Integer] :sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call
|
40
|
+
# @return [Array<(SpendingReport, Integer, Hash)>] SpendingReport data, response status code and response headers
|
41
|
+
def get_spending_with_http_info(date, location, spending_type, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: ReportsApi.get_spending ...'
|
44
|
+
end
|
45
|
+
# verify the required parameter 'date' is set
|
46
|
+
if @api_client.config.client_side_validation && date.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'date' when calling ReportsApi.get_spending"
|
48
|
+
end
|
49
|
+
# verify the required parameter 'location' is set
|
50
|
+
if @api_client.config.client_side_validation && location.nil?
|
51
|
+
fail ArgumentError, "Missing the required parameter 'location' when calling ReportsApi.get_spending"
|
52
|
+
end
|
53
|
+
# verify the required parameter 'spending_type' is set
|
54
|
+
if @api_client.config.client_side_validation && spending_type.nil?
|
55
|
+
fail ArgumentError, "Missing the required parameter 'spending_type' when calling ReportsApi.get_spending"
|
56
|
+
end
|
57
|
+
# resource path
|
58
|
+
local_var_path = '/spending-reports'
|
59
|
+
|
60
|
+
# query parameters
|
61
|
+
query_params = opts[:query_params] || {}
|
62
|
+
query_params[:'date'] = date
|
63
|
+
query_params[:'location'] = location
|
64
|
+
query_params[:'spending_type'] = spending_type
|
65
|
+
query_params[:'sector'] = opts[:'sector'] if !opts[:'sector'].nil?
|
66
|
+
|
67
|
+
# header parameters
|
68
|
+
header_params = opts[:header_params] || {}
|
69
|
+
# HTTP header 'Accept' (if needed)
|
70
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
71
|
+
|
72
|
+
# form parameters
|
73
|
+
form_params = opts[:form_params] || {}
|
74
|
+
|
75
|
+
# http body (model)
|
76
|
+
post_body = opts[:body]
|
77
|
+
|
78
|
+
# return_type
|
79
|
+
return_type = opts[:return_type] || 'SpendingReport'
|
80
|
+
|
81
|
+
# auth_names
|
82
|
+
auth_names = opts[:auth_names] || []
|
83
|
+
|
84
|
+
new_options = opts.merge(
|
85
|
+
:header_params => header_params,
|
86
|
+
:query_params => query_params,
|
87
|
+
:form_params => form_params,
|
88
|
+
:body => post_body,
|
89
|
+
:auth_names => auth_names,
|
90
|
+
:return_type => return_type
|
91
|
+
)
|
92
|
+
|
93
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
94
|
+
if @api_client.config.debugging
|
95
|
+
@api_client.config.logger.debug "API called: ReportsApi#get_spending\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
96
|
+
end
|
97
|
+
return data, status_code, headers
|
98
|
+
end
|
99
|
+
|
100
|
+
# Retrieves the top grossing locations for the specified date/sector/spending type
|
101
|
+
# @param date [Date] The date for the requested data
|
102
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
103
|
+
# @param [Hash] opts the optional parameters
|
104
|
+
# @option opts [Integer] :sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call
|
105
|
+
# @option opts [Integer] :limit Can be used to limit the amount of results returned from a query (Pagination)
|
106
|
+
# @option opts [Integer] :offset The number of items to offset the start of the list from (Pagination)
|
107
|
+
# @return [TopLocationsReport]
|
108
|
+
def get_top_locations(date, spending_type, opts = {})
|
109
|
+
data, _status_code, _headers = get_top_locations_with_http_info(date, spending_type, opts)
|
110
|
+
data
|
111
|
+
end
|
112
|
+
|
113
|
+
# Retrieves the top grossing locations for the specified date/sector/spending type
|
114
|
+
# @param date [Date] The date for the requested data
|
115
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
116
|
+
# @param [Hash] opts the optional parameters
|
117
|
+
# @option opts [Integer] :sector The sector for which you wish to receive reports. Sector ids can be retrieved from sectors call
|
118
|
+
# @option opts [Integer] :limit Can be used to limit the amount of results returned from a query (Pagination)
|
119
|
+
# @option opts [Integer] :offset The number of items to offset the start of the list from (Pagination)
|
120
|
+
# @return [Array<(TopLocationsReport, Integer, Hash)>] TopLocationsReport data, response status code and response headers
|
121
|
+
def get_top_locations_with_http_info(date, spending_type, opts = {})
|
122
|
+
if @api_client.config.debugging
|
123
|
+
@api_client.config.logger.debug 'Calling API: ReportsApi.get_top_locations ...'
|
124
|
+
end
|
125
|
+
# verify the required parameter 'date' is set
|
126
|
+
if @api_client.config.client_side_validation && date.nil?
|
127
|
+
fail ArgumentError, "Missing the required parameter 'date' when calling ReportsApi.get_top_locations"
|
128
|
+
end
|
129
|
+
# verify the required parameter 'spending_type' is set
|
130
|
+
if @api_client.config.client_side_validation && spending_type.nil?
|
131
|
+
fail ArgumentError, "Missing the required parameter 'spending_type' when calling ReportsApi.get_top_locations"
|
132
|
+
end
|
133
|
+
# resource path
|
134
|
+
local_var_path = '/top-locations'
|
135
|
+
|
136
|
+
# query parameters
|
137
|
+
query_params = opts[:query_params] || {}
|
138
|
+
query_params[:'date'] = date
|
139
|
+
query_params[:'spending_type'] = spending_type
|
140
|
+
query_params[:'sector'] = opts[:'sector'] if !opts[:'sector'].nil?
|
141
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
142
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
143
|
+
|
144
|
+
# header parameters
|
145
|
+
header_params = opts[:header_params] || {}
|
146
|
+
# HTTP header 'Accept' (if needed)
|
147
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
148
|
+
|
149
|
+
# form parameters
|
150
|
+
form_params = opts[:form_params] || {}
|
151
|
+
|
152
|
+
# http body (model)
|
153
|
+
post_body = opts[:body]
|
154
|
+
|
155
|
+
# return_type
|
156
|
+
return_type = opts[:return_type] || 'TopLocationsReport'
|
157
|
+
|
158
|
+
# auth_names
|
159
|
+
auth_names = opts[:auth_names] || []
|
160
|
+
|
161
|
+
new_options = opts.merge(
|
162
|
+
:header_params => header_params,
|
163
|
+
:query_params => query_params,
|
164
|
+
:form_params => form_params,
|
165
|
+
:body => post_body,
|
166
|
+
:auth_names => auth_names,
|
167
|
+
:return_type => return_type
|
168
|
+
)
|
169
|
+
|
170
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
171
|
+
if @api_client.config.debugging
|
172
|
+
@api_client.config.logger.debug "API called: ReportsApi#get_top_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
173
|
+
end
|
174
|
+
return data, status_code, headers
|
175
|
+
end
|
176
|
+
|
177
|
+
# Retrieves the top grossing sectors for the specified date & location
|
178
|
+
# @param date [Date] The date for the requested data
|
179
|
+
# @param location [String] The location for which you wish to receive the top-sectors report.
|
180
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
181
|
+
# @param [Hash] opts the optional parameters
|
182
|
+
# @return [Array<Array>]
|
183
|
+
def get_top_sectors(date, location, spending_type, opts = {})
|
184
|
+
data, _status_code, _headers = get_top_sectors_with_http_info(date, location, spending_type, opts)
|
185
|
+
data
|
186
|
+
end
|
187
|
+
|
188
|
+
# Retrieves the top grossing sectors for the specified date & location
|
189
|
+
# @param date [Date] The date for the requested data
|
190
|
+
# @param location [String] The location for which you wish to receive the top-sectors report.
|
191
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
192
|
+
# @param [Hash] opts the optional parameters
|
193
|
+
# @return [Array<(Array<Array>, Integer, Hash)>] Array<Array> data, response status code and response headers
|
194
|
+
def get_top_sectors_with_http_info(date, location, spending_type, opts = {})
|
195
|
+
if @api_client.config.debugging
|
196
|
+
@api_client.config.logger.debug 'Calling API: ReportsApi.get_top_sectors ...'
|
197
|
+
end
|
198
|
+
# verify the required parameter 'date' is set
|
199
|
+
if @api_client.config.client_side_validation && date.nil?
|
200
|
+
fail ArgumentError, "Missing the required parameter 'date' when calling ReportsApi.get_top_sectors"
|
201
|
+
end
|
202
|
+
# verify the required parameter 'location' is set
|
203
|
+
if @api_client.config.client_side_validation && location.nil?
|
204
|
+
fail ArgumentError, "Missing the required parameter 'location' when calling ReportsApi.get_top_sectors"
|
205
|
+
end
|
206
|
+
# verify the required parameter 'spending_type' is set
|
207
|
+
if @api_client.config.client_side_validation && spending_type.nil?
|
208
|
+
fail ArgumentError, "Missing the required parameter 'spending_type' when calling ReportsApi.get_top_sectors"
|
209
|
+
end
|
210
|
+
# resource path
|
211
|
+
local_var_path = '/top-sectors'
|
212
|
+
|
213
|
+
# query parameters
|
214
|
+
query_params = opts[:query_params] || {}
|
215
|
+
query_params[:'date'] = date
|
216
|
+
query_params[:'location'] = location
|
217
|
+
query_params[:'spending_type'] = spending_type
|
218
|
+
|
219
|
+
# header parameters
|
220
|
+
header_params = opts[:header_params] || {}
|
221
|
+
# HTTP header 'Accept' (if needed)
|
222
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
223
|
+
|
224
|
+
# form parameters
|
225
|
+
form_params = opts[:form_params] || {}
|
226
|
+
|
227
|
+
# http body (model)
|
228
|
+
post_body = opts[:body]
|
229
|
+
|
230
|
+
# return_type
|
231
|
+
return_type = opts[:return_type] || 'Array<Array>'
|
232
|
+
|
233
|
+
# auth_names
|
234
|
+
auth_names = opts[:auth_names] || []
|
235
|
+
|
236
|
+
new_options = opts.merge(
|
237
|
+
:header_params => header_params,
|
238
|
+
:query_params => query_params,
|
239
|
+
:form_params => form_params,
|
240
|
+
:body => post_body,
|
241
|
+
:auth_names => auth_names,
|
242
|
+
:return_type => return_type
|
243
|
+
)
|
244
|
+
|
245
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
246
|
+
if @api_client.config.debugging
|
247
|
+
@api_client.config.logger.debug "API called: ReportsApi#get_top_sectors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
248
|
+
end
|
249
|
+
return data, status_code, headers
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
=begin
|
2
|
+
#Golden Service API
|
3
|
+
|
4
|
+
#An API that conforms to the standards and best practices that should be adhered to in all Mastercard owned APIs. Can be used to create subscriptions to reports that are generated twice daily (6am & 6pm) that deliver e-commerce spending across multiple sectors and locations. <br/> --- * **All requests must be signed using oauth 1.0a. Please refer to: https://developer.mastercard.com/platform/documentation/using-oauth-1a-to-access-mastercard-apis/** --- * **The user must provide their card details when creating a subscription. These details must be encrypted before entering transit. Please refer to [Mastercard security](https://stage.developer.mastercard.com/platform/documentation/securing-sensitive-data-using-payload-encryption/)** ---
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.1.0
|
7
|
+
Contact: developers@mastercard.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module OpenapiClient
|
16
|
+
class SectorApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Returns the valid sectors which can be passed to various other endpoints in the sector field
|
23
|
+
# @param [Hash] opts the optional parameters
|
24
|
+
# @return [Array<Sector>]
|
25
|
+
def get_sectors(opts = {})
|
26
|
+
data, _status_code, _headers = get_sectors_with_http_info(opts)
|
27
|
+
data
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns the valid sectors which can be passed to various other endpoints in the sector field
|
31
|
+
# @param [Hash] opts the optional parameters
|
32
|
+
# @return [Array<(Array<Sector>, Integer, Hash)>] Array<Sector> data, response status code and response headers
|
33
|
+
def get_sectors_with_http_info(opts = {})
|
34
|
+
if @api_client.config.debugging
|
35
|
+
@api_client.config.logger.debug 'Calling API: SectorApi.get_sectors ...'
|
36
|
+
end
|
37
|
+
# resource path
|
38
|
+
local_var_path = '/sectors'
|
39
|
+
|
40
|
+
# query parameters
|
41
|
+
query_params = opts[:query_params] || {}
|
42
|
+
|
43
|
+
# header parameters
|
44
|
+
header_params = opts[:header_params] || {}
|
45
|
+
# HTTP header 'Accept' (if needed)
|
46
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
47
|
+
|
48
|
+
# form parameters
|
49
|
+
form_params = opts[:form_params] || {}
|
50
|
+
|
51
|
+
# http body (model)
|
52
|
+
post_body = opts[:body]
|
53
|
+
|
54
|
+
# return_type
|
55
|
+
return_type = opts[:return_type] || 'Array<Sector>'
|
56
|
+
|
57
|
+
# auth_names
|
58
|
+
auth_names = opts[:auth_names] || []
|
59
|
+
|
60
|
+
new_options = opts.merge(
|
61
|
+
:header_params => header_params,
|
62
|
+
:query_params => query_params,
|
63
|
+
:form_params => form_params,
|
64
|
+
:body => post_body,
|
65
|
+
:auth_names => auth_names,
|
66
|
+
:return_type => return_type
|
67
|
+
)
|
68
|
+
|
69
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
70
|
+
if @api_client.config.debugging
|
71
|
+
@api_client.config.logger.debug "API called: SectorApi#get_sectors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
72
|
+
end
|
73
|
+
return data, status_code, headers
|
74
|
+
end
|
75
|
+
|
76
|
+
# Retrieves the top grossing sectors for the specified date & location
|
77
|
+
# @param date [Date] The date for the requested data
|
78
|
+
# @param location [String] The location for which you wish to receive the top-sectors report.
|
79
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
80
|
+
# @param [Hash] opts the optional parameters
|
81
|
+
# @return [Array<Array>]
|
82
|
+
def get_top_sectors(date, location, spending_type, opts = {})
|
83
|
+
data, _status_code, _headers = get_top_sectors_with_http_info(date, location, spending_type, opts)
|
84
|
+
data
|
85
|
+
end
|
86
|
+
|
87
|
+
# Retrieves the top grossing sectors for the specified date & location
|
88
|
+
# @param date [Date] The date for the requested data
|
89
|
+
# @param location [String] The location for which you wish to receive the top-sectors report.
|
90
|
+
# @param spending_type [String] Used to distinguish between gross spending (GS) & average transaction value (ATV)
|
91
|
+
# @param [Hash] opts the optional parameters
|
92
|
+
# @return [Array<(Array<Array>, Integer, Hash)>] Array<Array> data, response status code and response headers
|
93
|
+
def get_top_sectors_with_http_info(date, location, spending_type, opts = {})
|
94
|
+
if @api_client.config.debugging
|
95
|
+
@api_client.config.logger.debug 'Calling API: SectorApi.get_top_sectors ...'
|
96
|
+
end
|
97
|
+
# verify the required parameter 'date' is set
|
98
|
+
if @api_client.config.client_side_validation && date.nil?
|
99
|
+
fail ArgumentError, "Missing the required parameter 'date' when calling SectorApi.get_top_sectors"
|
100
|
+
end
|
101
|
+
# verify the required parameter 'location' is set
|
102
|
+
if @api_client.config.client_side_validation && location.nil?
|
103
|
+
fail ArgumentError, "Missing the required parameter 'location' when calling SectorApi.get_top_sectors"
|
104
|
+
end
|
105
|
+
# verify the required parameter 'spending_type' is set
|
106
|
+
if @api_client.config.client_side_validation && spending_type.nil?
|
107
|
+
fail ArgumentError, "Missing the required parameter 'spending_type' when calling SectorApi.get_top_sectors"
|
108
|
+
end
|
109
|
+
# resource path
|
110
|
+
local_var_path = '/top-sectors'
|
111
|
+
|
112
|
+
# query parameters
|
113
|
+
query_params = opts[:query_params] || {}
|
114
|
+
query_params[:'date'] = date
|
115
|
+
query_params[:'location'] = location
|
116
|
+
query_params[:'spending_type'] = spending_type
|
117
|
+
|
118
|
+
# header parameters
|
119
|
+
header_params = opts[:header_params] || {}
|
120
|
+
# HTTP header 'Accept' (if needed)
|
121
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
122
|
+
|
123
|
+
# form parameters
|
124
|
+
form_params = opts[:form_params] || {}
|
125
|
+
|
126
|
+
# http body (model)
|
127
|
+
post_body = opts[:body]
|
128
|
+
|
129
|
+
# return_type
|
130
|
+
return_type = opts[:return_type] || 'Array<Array>'
|
131
|
+
|
132
|
+
# auth_names
|
133
|
+
auth_names = opts[:auth_names] || []
|
134
|
+
|
135
|
+
new_options = opts.merge(
|
136
|
+
:header_params => header_params,
|
137
|
+
:query_params => query_params,
|
138
|
+
:form_params => form_params,
|
139
|
+
:body => post_body,
|
140
|
+
:auth_names => auth_names,
|
141
|
+
:return_type => return_type
|
142
|
+
)
|
143
|
+
|
144
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
145
|
+
if @api_client.config.debugging
|
146
|
+
@api_client.config.logger.debug "API called: SectorApi#get_top_sectors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
147
|
+
end
|
148
|
+
return data, status_code, headers
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|