pnap_location_api 1.0.0
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/README.md +116 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/docs/Error.md +20 -0
- data/docs/Location.md +22 -0
- data/docs/LocationEnum.md +15 -0
- data/docs/LocationsApi.md +76 -0
- data/docs/ProductCategory.md +20 -0
- data/docs/ProductCategoryEnum.md +15 -0
- data/lib/pnap_location_api/api/locations_api.rb +85 -0
- data/lib/pnap_location_api/api_client.rb +393 -0
- data/lib/pnap_location_api/api_error.rb +57 -0
- data/lib/pnap_location_api/configuration.rb +272 -0
- data/lib/pnap_location_api/models/error.rb +237 -0
- data/lib/pnap_location_api/models/location.rb +245 -0
- data/lib/pnap_location_api/models/location_enum.rb +42 -0
- data/lib/pnap_location_api/models/product_category.rb +233 -0
- data/lib/pnap_location_api/models/product_category_enum.rb +40 -0
- data/lib/pnap_location_api/version.rb +19 -0
- data/lib/pnap_location_api.rb +45 -0
- data/pnap_location_api.gemspec +39 -0
- data/spec/api/locations_api_spec.rb +48 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/error_spec.rb +40 -0
- data/spec/models/location_enum_spec.rb +28 -0
- data/spec/models/location_spec.rb +46 -0
- data/spec/models/product_category_enum_spec.rb +28 -0
- data/spec/models/product_category_spec.rb +40 -0
- data/spec/spec_helper.rb +111 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ab7be44e474a0ef90f27d40ffd6c315fb7d2c092168bc7fd9fb0c466dad109b2
|
4
|
+
data.tar.gz: bf01c02c183f80d47d1e72a2203c10e75a4b5009a220e39b8d0a7050b1dafbd5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52e5bb9b67dd0ff803e0e8c919a80812b36f7fef87d8dc9a0e04792cba701493e54d54b532b4f24317a685232514fc91cbbb5eed54ad80841c84817c0f31c981
|
7
|
+
data.tar.gz: 4d451141a1025e8af54cfad191871aa5107ca6628bd9436279f7b3ff9338589892d157d4a6fd87ae68f9b7f8968197c31506519b6da9a4677cf9f3b263c880cd
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
# pnap_location_api
|
2
|
+
|
3
|
+
LocationApi - the Ruby gem for the Locations API
|
4
|
+
|
5
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
8
|
+
|
9
|
+
- API version: 1.0
|
10
|
+
For more information, please visit [https://phoenixnap.com](https://phoenixnap.com)
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
### Build a gem
|
15
|
+
|
16
|
+
To build the Ruby code into a gem:
|
17
|
+
|
18
|
+
```shell
|
19
|
+
gem build pnap_location_api.gemspec
|
20
|
+
```
|
21
|
+
|
22
|
+
Then either install the gem locally, replacing `<VERSION>` with the actual version:
|
23
|
+
|
24
|
+
```shell
|
25
|
+
gem install ./pnap_location_api-<VERSION>.gem
|
26
|
+
```
|
27
|
+
|
28
|
+
(for development, run `gem install --dev ./pnap_location_api-<VERSION>.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 'pnap_location_api', '~> <VERSION>'
|
35
|
+
|
36
|
+
### Install from Git
|
37
|
+
|
38
|
+
To install this Gem from this repository, you'll need to get Bundler by doing `gem install bundler`. Add the following line in your Gemfile:
|
39
|
+
|
40
|
+
gem 'pnap_location_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'LocationApi/*.gemspec'
|
41
|
+
|
42
|
+
If you'd like the development version:
|
43
|
+
|
44
|
+
gem 'pnap_location_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'LocationApi/*.gemspec', branch: 'develop'
|
45
|
+
|
46
|
+
Then run `bundle install`.
|
47
|
+
|
48
|
+
### Include the Ruby code directly
|
49
|
+
|
50
|
+
Include the Ruby code directly using `-I` as follows:
|
51
|
+
|
52
|
+
```shell
|
53
|
+
ruby -Ilib script.rb
|
54
|
+
```
|
55
|
+
|
56
|
+
## Getting Started
|
57
|
+
|
58
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
# Load the gem
|
62
|
+
require 'pnap_location_api'
|
63
|
+
|
64
|
+
api_instance = LocationApi::LocationsApi.new
|
65
|
+
opts = {
|
66
|
+
location: LocationApi::LocationEnum::PHX, # LocationEnum | Location of interest
|
67
|
+
product_category: LocationApi::ProductCategoryEnum::SERVER # ProductCategoryEnum | Product category of interest
|
68
|
+
}
|
69
|
+
|
70
|
+
begin
|
71
|
+
#Get All Locations
|
72
|
+
result = api_instance.get_locations(opts)
|
73
|
+
p result
|
74
|
+
rescue LocationApi::ApiError => e
|
75
|
+
puts "Exception when calling LocationsApi->get_locations: #{e}"
|
76
|
+
end
|
77
|
+
|
78
|
+
```
|
79
|
+
|
80
|
+
Authorization can also be setup by using the [`oauth`](https://github.com/oauth-xx/oauth2) library:
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
# Load the gem
|
84
|
+
require 'pnap_location_api'
|
85
|
+
require 'oauth2'
|
86
|
+
|
87
|
+
# Setup variables for getting a token.
|
88
|
+
client_id = 'YOUR_CLIENT_ID'
|
89
|
+
client_secret = 'YOUR_CLIENT_SECRET'
|
90
|
+
auth_url = 'https://auth.phoenixnap.com/auth/realms/BMC/protocol/openid-connect/token'
|
91
|
+
|
92
|
+
|
93
|
+
```
|
94
|
+
|
95
|
+
## Documentation for API Endpoints
|
96
|
+
|
97
|
+
All URIs are relative to *https://api.phoenixnap.com/location-api/v1*
|
98
|
+
|
99
|
+
Class | Method | HTTP request | Description
|
100
|
+
------------ | ------------- | ------------- | -------------
|
101
|
+
*LocationApi::LocationsApi* | [**get_locations**](docs/LocationsApi.md#get_locations) | **GET** /locations | Get All Locations
|
102
|
+
|
103
|
+
|
104
|
+
## Documentation for Models
|
105
|
+
|
106
|
+
- [LocationApi::Error](docs/Error.md)
|
107
|
+
- [LocationApi::Location](docs/Location.md)
|
108
|
+
- [LocationApi::LocationEnum](docs/LocationEnum.md)
|
109
|
+
- [LocationApi::ProductCategory](docs/ProductCategory.md)
|
110
|
+
- [LocationApi::ProductCategoryEnum](docs/ProductCategoryEnum.md)
|
111
|
+
|
112
|
+
|
113
|
+
## Documentation for Authorization
|
114
|
+
|
115
|
+
All endpoints do not require authorization.
|
116
|
+
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/docs/Error.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# LocationApi::Error
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **message** | **String** | The description detailing the cause of the error code. | [readonly] |
|
8
|
+
| **validation_errors** | **Array<String>** | Validation errors, if any. | [optional][readonly] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'pnap_location_api'
|
14
|
+
|
15
|
+
instance = LocationApi::Error.new(
|
16
|
+
message: null,
|
17
|
+
validation_errors: null
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
data/docs/Location.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# LocationApi::Location
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **location** | [**LocationEnum**](LocationEnum.md) | | |
|
8
|
+
| **location_description** | **String** | | [optional] |
|
9
|
+
| **product_categories** | [**Array<ProductCategory>**](ProductCategory.md) | | [optional] |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'pnap_location_api'
|
15
|
+
|
16
|
+
instance = LocationApi::Location.new(
|
17
|
+
location: null,
|
18
|
+
location_description: Phoenix, USA,
|
19
|
+
product_categories: null
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# LocationApi::LocationsApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.phoenixnap.com/location-api/v1*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**get_locations**](LocationsApi.md#get_locations) | **GET** /locations | Get All Locations |
|
8
|
+
|
9
|
+
|
10
|
+
## get_locations
|
11
|
+
|
12
|
+
> <Array<Location>> get_locations(opts)
|
13
|
+
|
14
|
+
Get All Locations
|
15
|
+
|
16
|
+
Retrieve the locations info.
|
17
|
+
|
18
|
+
### Examples
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'time'
|
22
|
+
require 'pnap_location_api'
|
23
|
+
|
24
|
+
api_instance = LocationApi::LocationsApi.new
|
25
|
+
opts = {
|
26
|
+
location: LocationApi::LocationEnum::PHX, # LocationEnum | Location of interest
|
27
|
+
product_category: LocationApi::ProductCategoryEnum::SERVER # ProductCategoryEnum | Product category of interest
|
28
|
+
}
|
29
|
+
|
30
|
+
begin
|
31
|
+
# Get All Locations
|
32
|
+
result = api_instance.get_locations(opts)
|
33
|
+
p result
|
34
|
+
rescue LocationApi::ApiError => e
|
35
|
+
puts "Error when calling LocationsApi->get_locations: #{e}"
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
#### Using the get_locations_with_http_info variant
|
40
|
+
|
41
|
+
This returns an Array which contains the response data, status code and headers.
|
42
|
+
|
43
|
+
> <Array(<Array<Location>>, Integer, Hash)> get_locations_with_http_info(opts)
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
begin
|
47
|
+
# Get All Locations
|
48
|
+
data, status_code, headers = api_instance.get_locations_with_http_info(opts)
|
49
|
+
p status_code # => 2xx
|
50
|
+
p headers # => { ... }
|
51
|
+
p data # => <Array<Location>>
|
52
|
+
rescue LocationApi::ApiError => e
|
53
|
+
puts "Error when calling LocationsApi->get_locations_with_http_info: #{e}"
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
### Parameters
|
58
|
+
|
59
|
+
| Name | Type | Description | Notes |
|
60
|
+
| ---- | ---- | ----------- | ----- |
|
61
|
+
| **location** | [**LocationEnum**](.md) | Location of interest | [optional] |
|
62
|
+
| **product_category** | [**ProductCategoryEnum**](.md) | Product category of interest | [optional] |
|
63
|
+
|
64
|
+
### Return type
|
65
|
+
|
66
|
+
[**Array<Location>**](Location.md)
|
67
|
+
|
68
|
+
### Authorization
|
69
|
+
|
70
|
+
No authorization required
|
71
|
+
|
72
|
+
### HTTP request headers
|
73
|
+
|
74
|
+
- **Content-Type**: Not defined
|
75
|
+
- **Accept**: application/json
|
76
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# LocationApi::ProductCategory
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **product_category** | [**ProductCategoryEnum**](ProductCategoryEnum.md) | | |
|
8
|
+
| **product_category_description** | **String** | | [optional] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'pnap_location_api'
|
14
|
+
|
15
|
+
instance = LocationApi::ProductCategory.new(
|
16
|
+
product_category: null,
|
17
|
+
product_category_description: Bare metal server
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# LocationApi::ProductCategoryEnum
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
|
8
|
+
## Example
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require 'pnap_location_api'
|
12
|
+
|
13
|
+
instance = LocationApi::ProductCategoryEnum.new()
|
14
|
+
```
|
15
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
=begin
|
2
|
+
#Locations API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: support@phoenixnap.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.1.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module LocationApi
|
16
|
+
class LocationsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Get All Locations
|
23
|
+
# Retrieve the locations info.
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [LocationEnum] :location Location of interest
|
26
|
+
# @option opts [ProductCategoryEnum] :product_category Product category of interest
|
27
|
+
# @return [Array<Location>]
|
28
|
+
def get_locations(opts = {})
|
29
|
+
data, _status_code, _headers = get_locations_with_http_info(opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get All Locations
|
34
|
+
# Retrieve the locations info.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @option opts [LocationEnum] :location Location of interest
|
37
|
+
# @option opts [ProductCategoryEnum] :product_category Product category of interest
|
38
|
+
# @return [Array<(Array<Location>, Integer, Hash)>] Array<Location> data, response status code and response headers
|
39
|
+
def get_locations_with_http_info(opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: LocationsApi.get_locations ...'
|
42
|
+
end
|
43
|
+
# resource path
|
44
|
+
local_var_path = '/locations'
|
45
|
+
|
46
|
+
# query parameters
|
47
|
+
query_params = opts[:query_params] || {}
|
48
|
+
query_params[:'location'] = opts[:'location'] if !opts[:'location'].nil?
|
49
|
+
query_params[:'productCategory'] = opts[:'product_category'] if !opts[:'product_category'].nil?
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
55
|
+
|
56
|
+
# form parameters
|
57
|
+
form_params = opts[:form_params] || {}
|
58
|
+
|
59
|
+
# http body (model)
|
60
|
+
post_body = opts[:debug_body]
|
61
|
+
|
62
|
+
# return_type
|
63
|
+
return_type = opts[:debug_return_type] || 'Array<Location>'
|
64
|
+
|
65
|
+
# auth_names
|
66
|
+
auth_names = opts[:debug_auth_names] || []
|
67
|
+
|
68
|
+
new_options = opts.merge(
|
69
|
+
:operation => :"LocationsApi.get_locations",
|
70
|
+
:header_params => header_params,
|
71
|
+
:query_params => query_params,
|
72
|
+
:form_params => form_params,
|
73
|
+
:body => post_body,
|
74
|
+
:auth_names => auth_names,
|
75
|
+
:return_type => return_type
|
76
|
+
)
|
77
|
+
|
78
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
79
|
+
if @api_client.config.debugging
|
80
|
+
@api_client.config.logger.debug "API called: LocationsApi#get_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
81
|
+
end
|
82
|
+
return data, status_code, headers
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|