ultracart_api 4.1.12 → 4.1.14

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.
@@ -6,6 +6,7 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **exclude_coupon** | **Boolean** | Exclude coupons | [optional] |
8
8
  | **exclude_from_free_promotion** | **Boolean** | Exclude from free promotion | [optional] |
9
+ | **exclude_from_loyalty** | **Boolean** | Exclude from loyalty. Must be set to true or false to save. Null is ignored for backwards SDK compatibility | [optional] |
9
10
  | **items** | [**Array<ItemRestrictionItem>**](ItemRestrictionItem.md) | Items | [optional] |
10
11
  | **maximum_quantity** | **Integer** | Maximum quantity | [optional] |
11
12
  | **minimum_quantity** | **Integer** | Minimum quantity (defaults to 1) | [optional] |
@@ -21,6 +22,7 @@ require 'ultracart_api'
21
22
  instance = UltracartClient::ItemRestriction.new(
22
23
  exclude_coupon: null,
23
24
  exclude_from_free_promotion: null,
25
+ exclude_from_loyalty: null,
24
26
  items: null,
25
27
  maximum_quantity: null,
26
28
  minimum_quantity: null,
data/docs/OauthApi.md CHANGED
@@ -1,163 +1,203 @@
1
- # UltracartClient::OauthApi
2
-
3
- All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
-
5
- | Method | HTTP request | Description |
6
- | ------ | ------------ | ----------- |
7
- | [**oauth_access_token**](OauthApi.md#oauth_access_token) | **POST** /oauth/token | Exchange authorization code for access token. |
8
- | [**oauth_revoke**](OauthApi.md#oauth_revoke) | **POST** /oauth/revoke | Revoke this OAuth application. |
9
-
10
-
11
- ## oauth_access_token
12
-
13
- > <OauthTokenResponse> oauth_access_token(client_id, grant_type, opts)
14
-
15
- Exchange authorization code for access token.
16
-
17
- The final leg in the OAuth process which exchanges the specified access token for the access code needed to make API calls.
18
-
19
- ### Examples
20
-
21
- ```ruby
22
- require 'time'
23
- require 'ultracart_api'
24
- require 'json'
25
- require 'yaml'
26
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
27
-
28
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
29
- # As such, this might not be the best way to use this object.
30
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
31
-
32
- api = UltracartClient::OauthApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
33
- client_id = 'client_id_example' # String | The OAuth application client_id.
34
- grant_type = 'grant_type_example' # String | Type of grant
35
- opts = {
36
- code: 'code_example', # String | Authorization code received back from the browser redirect
37
- redirect_uri: 'redirect_uri_example', # String | The URI that you redirect the browser to start the authorization process
38
- refresh_token: 'refresh_token_example' # String | The refresh token received during the original grant_type=authorization_code that can be used to return a new access token
39
- }
40
-
41
- begin
42
- # Exchange authorization code for access token.
43
- result = api_instance.oauth_access_token(client_id, grant_type, opts)
44
- p result
45
- rescue UltracartClient::ApiError => e
46
- puts "Error when calling OauthApi->oauth_access_token: #{e}"
47
- end
48
- ```
49
-
50
- #### Using the oauth_access_token_with_http_info variant
51
-
52
- This returns an Array which contains the response data, status code and headers.
53
-
54
- > <Array(<OauthTokenResponse>, Integer, Hash)> oauth_access_token_with_http_info(client_id, grant_type, opts)
55
-
56
- ```ruby
57
- begin
58
- # Exchange authorization code for access token.
59
- data, status_code, headers = api_instance.oauth_access_token_with_http_info(client_id, grant_type, opts)
60
- p status_code # => 2xx
61
- p headers # => { ... }
62
- p data # => <OauthTokenResponse>
63
- rescue UltracartClient::ApiError => e
64
- puts "Error when calling OauthApi->oauth_access_token_with_http_info: #{e}"
65
- end
66
- ```
67
-
68
- ### Parameters
69
-
70
- | Name | Type | Description | Notes |
71
- | ---- | ---- | ----------- | ----- |
72
- | **client_id** | **String** | The OAuth application client_id. | |
73
- | **grant_type** | **String** | Type of grant | |
74
- | **code** | **String** | Authorization code received back from the browser redirect | [optional] |
75
- | **redirect_uri** | **String** | The URI that you redirect the browser to start the authorization process | [optional] |
76
- | **refresh_token** | **String** | The refresh token received during the original grant_type&#x3D;authorization_code that can be used to return a new access token | [optional] |
77
-
78
- ### Return type
79
-
80
- [**OauthTokenResponse**](OauthTokenResponse.md)
81
-
82
- ### Authorization
83
-
84
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
85
-
86
- ### HTTP request headers
87
-
88
- - **Content-Type**: application/x-www-form-urlencoded
89
- - **Accept**: application/json
90
-
91
-
92
- ## oauth_revoke
93
-
94
- > <OauthRevokeSuccessResponse> oauth_revoke(client_id, token)
95
-
96
- Revoke this OAuth application.
97
-
98
- Revokes the OAuth application associated with the specified client_id and token.
99
-
100
- ### Examples
101
-
102
- ```ruby
103
- require 'time'
104
- require 'ultracart_api'
105
- require 'json'
106
- require 'yaml'
107
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
108
-
109
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
110
- # As such, this might not be the best way to use this object.
111
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
112
-
113
- api = UltracartClient::OauthApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
114
- client_id = 'client_id_example' # String | The OAuth application client_id.
115
- token = 'token_example' # String | The OAuth access token that is to be revoked..
116
-
117
- begin
118
- # Revoke this OAuth application.
119
- result = api_instance.oauth_revoke(client_id, token)
120
- p result
121
- rescue UltracartClient::ApiError => e
122
- puts "Error when calling OauthApi->oauth_revoke: #{e}"
123
- end
124
- ```
125
-
126
- #### Using the oauth_revoke_with_http_info variant
127
-
128
- This returns an Array which contains the response data, status code and headers.
129
-
130
- > <Array(<OauthRevokeSuccessResponse>, Integer, Hash)> oauth_revoke_with_http_info(client_id, token)
131
-
132
- ```ruby
133
- begin
134
- # Revoke this OAuth application.
135
- data, status_code, headers = api_instance.oauth_revoke_with_http_info(client_id, token)
136
- p status_code # => 2xx
137
- p headers # => { ... }
138
- p data # => <OauthRevokeSuccessResponse>
139
- rescue UltracartClient::ApiError => e
140
- puts "Error when calling OauthApi->oauth_revoke_with_http_info: #{e}"
141
- end
142
- ```
143
-
144
- ### Parameters
145
-
146
- | Name | Type | Description | Notes |
147
- | ---- | ---- | ----------- | ----- |
148
- | **client_id** | **String** | The OAuth application client_id. | |
149
- | **token** | **String** | The OAuth access token that is to be revoked.. | |
150
-
151
- ### Return type
152
-
153
- [**OauthRevokeSuccessResponse**](OauthRevokeSuccessResponse.md)
154
-
155
- ### Authorization
156
-
157
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
158
-
159
- ### HTTP request headers
160
-
161
- - **Content-Type**: application/x-www-form-urlencoded
162
- - **Accept**: application/json
163
-
1
+ # UltracartClient::OauthApi
2
+
3
+ All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**oauth_access_token**](OauthApi.md#oauth_access_token) | **POST** /oauth/token | Exchange authorization code for access token. |
8
+ | [**oauth_revoke**](OauthApi.md#oauth_revoke) | **POST** /oauth/revoke | Revoke this OAuth application. |
9
+
10
+
11
+ ## oauth_access_token
12
+
13
+ > <OauthTokenResponse> oauth_access_token(client_id, grant_type, opts)
14
+
15
+ Exchange authorization code for access token.
16
+
17
+ The final leg in the OAuth process which exchanges the specified access token for the access code needed to make API calls.
18
+
19
+
20
+ ### Examples
21
+
22
+ ```ruby
23
+ require 'ultracart_api'
24
+ require_relative '../constants'
25
+
26
+ =begin
27
+
28
+ The first step in implementing an OAuth authorization to your UltraCart Developer Application is
29
+ creating a Client ID and Secret. See the following doc for instructions on doing so:
30
+ https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/3488907265/Developer+Applications+-+Creating+a+Client+ID+and+Secret+for+an+OAuth+Application
31
+
32
+ The second step is to construct an authorize url for your customers to follow and authorize your application.
33
+ See the oauthAuthorize.rb for an example on constructing that url.
34
+
35
+ This method, OAuth.oauth_access_token() will be called from within your redirect script, i.e. that web page the
36
+ customer is redirected to by UltraCart after successfully authorizing your application.
37
+
38
+ This example illustrates how to retrieve the code parameter and exchange it for an access_token and refresh_token.
39
+
40
+ Once you have your Client ID and Secret created, our OAuth security follows the industry standards.
41
+ 1. Construct an authorize url for your customers.
42
+ 2. Your customers will follow the link and authorize your application.
43
+ 3. Store their oauth credentials as best fits your application.
44
+
45
+ Parameters this script should expect:
46
+ code -> used to exchange for an access token
47
+ state -> whatever you passed in your authorize url
48
+ error -> if you have a problem with your application configure. Possible values are:
49
+ invalid_request -> your authorize url has expired
50
+ access_denied -> user said 'no' and did not grant access.
51
+
52
+ Parameters you will use to retrieve a token:
53
+ code -> the value provided as a query parameter from UltraCart, required if grant_type is 'authorization_code'
54
+ client_id -> your client id (see doc link at top of this file)
55
+ grant_type -> 'authorization_code' or 'refresh_token'
56
+ redirect_url -> The URI that you redirect the browser to start the authorization process
57
+ refresh_token -> if grant_type = 'refresh_token', you have to provide the refresh token. makes sense, yes?
58
+
59
+ See OauthTokenResponse for fields that are returned from this call.
60
+ All SDKs have the same field names with slight differences in capitalization and underscores.
61
+ https://github.com/UltraCart/rest_api_v2_sdk_csharp/blob/master/src/com.ultracart.admin.v2/Model/OauthTokenResponse.cs
62
+
63
+ =end
64
+
65
+ client_id = "5e31ce86e17f02015a35257c47151544" # this is given to you when you create your application (see the doc link above)
66
+ grant_type = "authorization_code"
67
+ redirect_url = "https://www.mywebsite.com/oauth/redirect_here.php"
68
+ state = "denmark" # this is whatever you used when you created your authorize url (see oauthAuthorize.rb)
69
+
70
+ code = params['code'] # Assuming this is running in a web framework that provides params
71
+ refresh_token = nil
72
+
73
+ oauth_api = UltracartClient::OauthApi.new_using_api_key(Constants::API_KEY)
74
+ api_response = oauth_api.oauth_access_token(client_id, grant_type, code, redirect_url, refresh_token)
75
+
76
+ # api_response is an OauthTokenResponse object.
77
+ puts api_response.inspect
78
+ refresh_token = api_response.refresh_token
79
+ expires_in = api_response.expires_in
80
+ ```
81
+
82
+
83
+ #### Using the oauth_access_token_with_http_info variant
84
+
85
+ This returns an Array which contains the response data, status code and headers.
86
+
87
+ > <Array(<OauthTokenResponse>, Integer, Hash)> oauth_access_token_with_http_info(client_id, grant_type, opts)
88
+
89
+ ```ruby
90
+ begin
91
+ # Exchange authorization code for access token.
92
+ data, status_code, headers = api_instance.oauth_access_token_with_http_info(client_id, grant_type, opts)
93
+ p status_code # => 2xx
94
+ p headers # => { ... }
95
+ p data # => <OauthTokenResponse>
96
+ rescue UltracartClient::ApiError => e
97
+ puts "Error when calling OauthApi->oauth_access_token_with_http_info: #{e}"
98
+ end
99
+ ```
100
+
101
+ ### Parameters
102
+
103
+ | Name | Type | Description | Notes |
104
+ | ---- | ---- | ----------- | ----- |
105
+ | **client_id** | **String** | The OAuth application client_id. | |
106
+ | **grant_type** | **String** | Type of grant | |
107
+ | **code** | **String** | Authorization code received back from the browser redirect | [optional] |
108
+ | **redirect_uri** | **String** | The URI that you redirect the browser to start the authorization process | [optional] |
109
+ | **refresh_token** | **String** | The refresh token received during the original grant_type&#x3D;authorization_code that can be used to return a new access token | [optional] |
110
+
111
+ ### Return type
112
+
113
+ [**OauthTokenResponse**](OauthTokenResponse.md)
114
+
115
+ ### Authorization
116
+
117
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
118
+
119
+ ### HTTP request headers
120
+
121
+ - **Content-Type**: application/x-www-form-urlencoded
122
+ - **Accept**: application/json
123
+
124
+
125
+ ## oauth_revoke
126
+
127
+ > <OauthRevokeSuccessResponse> oauth_revoke(client_id, token)
128
+
129
+ Revoke this OAuth application.
130
+
131
+ Revokes the OAuth application associated with the specified client_id and token.
132
+
133
+
134
+ ### Examples
135
+
136
+ ```ruby
137
+ require 'ultracart_api'
138
+ require_relative '../constants'
139
+
140
+ =begin
141
+
142
+ This is a last feature of the UltraCart OAuth Security Implementation.
143
+ oauthRevoke is used to kill an access token.
144
+ Call this method when a customer desires to terminate using your Developer Application.
145
+
146
+
147
+ The first step in implementing an OAuth authorization to your UltraCart Developer Application is
148
+ creating a Client ID and Secret. See the following doc for instructions on doing so:
149
+ https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/3488907265/Developer+Applications+-+Creating+a+Client+ID+and+Secret+for+an+OAuth+Application
150
+
151
+ =end
152
+
153
+ client_id = "5e31ce86e17f02015a35257c47151544" # this is given to you when you create your application (see the doc link above)
154
+ access_token = "123456789012345678901234567890" # this is stored by your application somewhere somehow.
155
+
156
+ oauth_api = UltracartClient::OauthApi.new_using_api_key(Constants::API_KEY)
157
+ api_response = oauth_api.oauth_revoke(client_id, access_token)
158
+
159
+ # api_response is an OauthRevokeSuccessResponse object.
160
+ puts api_response.inspect
161
+ successful = api_response.successful
162
+ message = api_response.message
163
+ ```
164
+
165
+
166
+ #### Using the oauth_revoke_with_http_info variant
167
+
168
+ This returns an Array which contains the response data, status code and headers.
169
+
170
+ > <Array(<OauthRevokeSuccessResponse>, Integer, Hash)> oauth_revoke_with_http_info(client_id, token)
171
+
172
+ ```ruby
173
+ begin
174
+ # Revoke this OAuth application.
175
+ data, status_code, headers = api_instance.oauth_revoke_with_http_info(client_id, token)
176
+ p status_code # => 2xx
177
+ p headers # => { ... }
178
+ p data # => <OauthRevokeSuccessResponse>
179
+ rescue UltracartClient::ApiError => e
180
+ puts "Error when calling OauthApi->oauth_revoke_with_http_info: #{e}"
181
+ end
182
+ ```
183
+
184
+ ### Parameters
185
+
186
+ | Name | Type | Description | Notes |
187
+ | ---- | ---- | ----------- | ----- |
188
+ | **client_id** | **String** | The OAuth application client_id. | |
189
+ | **token** | **String** | The OAuth access token that is to be revoked.. | |
190
+
191
+ ### Return type
192
+
193
+ [**OauthRevokeSuccessResponse**](OauthRevokeSuccessResponse.md)
194
+
195
+ ### Authorization
196
+
197
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
198
+
199
+ ### HTTP request headers
200
+
201
+ - **Content-Type**: application/x-www-form-urlencoded
202
+ - **Accept**: application/json
203
+