cloudsmith-api 2.0.30 → 2.0.31
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -4
- data/build.json +1 -1
- data/docs/NixPackageUploadRequest.md +1 -1
- data/docs/Oidc.md +7 -0
- data/docs/Oidc1.md +8 -0
- data/docs/OidcRequest.md +9 -0
- data/docs/OpenidApi.md +71 -0
- data/lib/cloudsmith-api/api/openid_api.rb +79 -0
- data/lib/cloudsmith-api/models/nix_package_upload_request.rb +7 -7
- data/lib/cloudsmith-api/models/oidc.rb +175 -0
- data/lib/cloudsmith-api/models/oidc_1.rb +185 -0
- data/lib/cloudsmith-api/models/oidc_request.rb +205 -0
- data/lib/cloudsmith-api/version.rb +1 -1
- data/lib/cloudsmith-api.rb +4 -0
- data/spec/api/openid_api_spec.rb +48 -0
- data/spec/models/nix_package_upload_request_spec.rb +1 -1
- data/spec/models/oidc_1_spec.rb +41 -0
- data/spec/models/oidc_request_spec.rb +47 -0
- data/spec/models/oidc_spec.rb +35 -0
- data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/autotest-fsevent-0.3.2/gem_make.out +1 -1
- data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/bigdecimal-4.1.2/gem_make.out +2 -2
- data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/bigdecimal-4.1.2/mkmf.log +4 -4
- data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.17.4/gem_make.out +2 -2
- data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.17.4/mkmf.log +1 -1
- data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.7.6/gem_make.out +2 -2
- data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.7.6/mkmf.log +1 -1
- data/vendor/bundle/ruby/2.6.0/gems/bigdecimal-4.1.2/ext/bigdecimal/Makefile +2 -2
- data/vendor/bundle/ruby/2.6.0/gems/ffi-1.17.4/ext/ffi_c/Makefile +2 -2
- data/vendor/bundle/ruby/2.6.0/gems/json-2.7.6/ext/json/ext/generator/Makefile +2 -2
- data/vendor/bundle/ruby/2.6.0/gems/json-2.7.6/ext/json/ext/parser/Makefile +2 -2
- metadata +20 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e6a644beee69453758b4b4b08a637705edc8928950c6651ed85adfa123fe6ed
|
|
4
|
+
data.tar.gz: 5c6214b5545df2e78f092555c3cf4496c1733cd7dd0fab9860157487beac6023
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8bdbd6e65eba92494234801992deea4ceab8eb55375b6292598774da3770590e5409fc12526d6f6360f1a74fccc0b9e0d595fd6309a5703b4f057d132c3f129
|
|
7
|
+
data.tar.gz: 52c06c95858a286d772a60aae5175c2ff7abf4cb206b3c765b9669dc7861a728401190d7f2327aba09248eb4043ba61369f3e83197183e4c60f891c892baaf19
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ The API to the Cloudsmith Service
|
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
|
8
8
|
|
|
9
9
|
- API version: v1
|
|
10
|
-
- Package version: 2.0.
|
|
10
|
+
- Package version: 2.0.31
|
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
|
12
12
|
For more information, please visit [https://help.cloudsmith.io](https://help.cloudsmith.io)
|
|
13
13
|
|
|
@@ -24,15 +24,15 @@ gem build cloudsmith-api.gemspec
|
|
|
24
24
|
Then either install the gem locally:
|
|
25
25
|
|
|
26
26
|
```shell
|
|
27
|
-
gem install ./cloudsmith-api-2.0.
|
|
27
|
+
gem install ./cloudsmith-api-2.0.31.gem
|
|
28
28
|
```
|
|
29
|
-
(for development, run `gem install --dev ./cloudsmith-api-2.0.
|
|
29
|
+
(for development, run `gem install --dev ./cloudsmith-api-2.0.31.gem` to install the development dependencies)
|
|
30
30
|
|
|
31
31
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
|
32
32
|
|
|
33
33
|
Finally add this to the Gemfile:
|
|
34
34
|
|
|
35
|
-
gem 'cloudsmith-api', '~> 2.0.
|
|
35
|
+
gem 'cloudsmith-api', '~> 2.0.31'
|
|
36
36
|
|
|
37
37
|
### Install from Git
|
|
38
38
|
|
|
@@ -123,6 +123,7 @@ Class | Method | HTTP request | Description
|
|
|
123
123
|
*CloudsmithApi::MetricsApi* | [**metrics_packages_list**](docs/MetricsApi.md#metrics_packages_list) | **GET** /metrics/packages/{owner}/{repo}/ | View for listing package usage metrics, for a repository.
|
|
124
124
|
*CloudsmithApi::NamespacesApi* | [**namespaces_list**](docs/NamespacesApi.md#namespaces_list) | **GET** /namespaces/ | Get a list of all namespaces the user belongs to.
|
|
125
125
|
*CloudsmithApi::NamespacesApi* | [**namespaces_read**](docs/NamespacesApi.md#namespaces_read) | **GET** /namespaces/{slug}/ | Get a specific namespace that the user belongs to.
|
|
126
|
+
*CloudsmithApi::OpenidApi* | [**openid_create**](docs/OpenidApi.md#openid_create) | **POST** /openid/{owner}/ | Get a JWT token for a configured service account belonging to the requesting org.
|
|
126
127
|
*CloudsmithApi::OrgsApi* | [**orgs_custom_domains_list**](docs/OrgsApi.md#orgs_custom_domains_list) | **GET** /orgs/{org}/custom-domains/ | Get the details for all custom domains.
|
|
127
128
|
*CloudsmithApi::OrgsApi* | [**orgs_delete**](docs/OrgsApi.md#orgs_delete) | **DELETE** /orgs/{org}/ | Delete the specified organization.
|
|
128
129
|
*CloudsmithApi::OrgsApi* | [**orgs_deny_policy_create**](docs/OrgsApi.md#orgs_deny_policy_create) | **POST** /orgs/{org}/deny-policy/ | Create a package deny policy.
|
|
@@ -597,6 +598,9 @@ Class | Method | HTTP request | Description
|
|
|
597
598
|
- [CloudsmithApi::NugetUpstream](docs/NugetUpstream.md)
|
|
598
599
|
- [CloudsmithApi::NugetUpstreamRequest](docs/NugetUpstreamRequest.md)
|
|
599
600
|
- [CloudsmithApi::NugetUpstreamRequestPatch](docs/NugetUpstreamRequestPatch.md)
|
|
601
|
+
- [CloudsmithApi::Oidc](docs/Oidc.md)
|
|
602
|
+
- [CloudsmithApi::Oidc1](docs/Oidc1.md)
|
|
603
|
+
- [CloudsmithApi::OidcRequest](docs/OidcRequest.md)
|
|
600
604
|
- [CloudsmithApi::Organization](docs/Organization.md)
|
|
601
605
|
- [CloudsmithApi::OrganizationCustomDomainNestedRepo](docs/OrganizationCustomDomainNestedRepo.md)
|
|
602
606
|
- [CloudsmithApi::OrganizationCustomDomains](docs/OrganizationCustomDomains.md)
|
data/build.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
|
6
6
|
**is_malware_detected** | **BOOLEAN** | Whether the package has been detected as containing malware. Requires Ultra plan. | [optional]
|
|
7
|
-
**
|
|
7
|
+
**narinfo_file** | **String** | The narinfo sidecar metadata file (<storeHash>.narinfo). Optional — the package can be completed later by publishing the matching narinfo via the native HTTP PUT path. | [optional]
|
|
8
8
|
**package_file** | **String** | The primary file for the package. |
|
|
9
9
|
**republish** | **BOOLEAN** | If true, the uploaded package will overwrite any others with the same attributes (e.g. same version); otherwise, it will be flagged as a duplicate. | [optional]
|
|
10
10
|
**tags** | **String** | A comma-separated values list of tags to add to the package. | [optional]
|
data/docs/Oidc.md
ADDED
data/docs/Oidc1.md
ADDED
data/docs/OidcRequest.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# CloudsmithApi::OidcRequest
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**oidc_token** | **String** | Serialized OIDC token. |
|
|
7
|
+
**service_slug** | **String** | Slug for the service account. |
|
|
8
|
+
|
|
9
|
+
|
data/docs/OpenidApi.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# CloudsmithApi::OpenidApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.cloudsmith.io*
|
|
4
|
+
|
|
5
|
+
Method | HTTP request | Description
|
|
6
|
+
------------- | ------------- | -------------
|
|
7
|
+
[**openid_create**](OpenidApi.md#openid_create) | **POST** /openid/{owner}/ | Get a JWT token for a configured service account belonging to the requesting org.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# **openid_create**
|
|
11
|
+
> Oidc1 openid_create(owner, opts)
|
|
12
|
+
|
|
13
|
+
Get a JWT token for a configured service account belonging to the requesting org.
|
|
14
|
+
|
|
15
|
+
Get a JWT token for a configured service account belonging to the requesting org.
|
|
16
|
+
|
|
17
|
+
### Example
|
|
18
|
+
```ruby
|
|
19
|
+
# load the gem
|
|
20
|
+
require 'cloudsmith-api'
|
|
21
|
+
# setup authorization
|
|
22
|
+
CloudsmithApi.configure do |config|
|
|
23
|
+
# Configure API key authorization: apikey
|
|
24
|
+
config.api_key['X-Api-Key'] = 'YOUR API KEY'
|
|
25
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
26
|
+
#config.api_key_prefix['X-Api-Key'] = 'Bearer'
|
|
27
|
+
|
|
28
|
+
# Configure HTTP basic authorization: basic
|
|
29
|
+
config.username = 'YOUR USERNAME'
|
|
30
|
+
config.password = 'YOUR PASSWORD'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
api_instance = CloudsmithApi::OpenidApi.new
|
|
34
|
+
|
|
35
|
+
owner = 'owner_example' # String |
|
|
36
|
+
|
|
37
|
+
opts = {
|
|
38
|
+
data: CloudsmithApi::OidcRequest.new # OidcRequest |
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
begin
|
|
42
|
+
#Get a JWT token for a configured service account belonging to the requesting org.
|
|
43
|
+
result = api_instance.openid_create(owner, opts)
|
|
44
|
+
p result
|
|
45
|
+
rescue CloudsmithApi::ApiError => e
|
|
46
|
+
puts "Exception when calling OpenidApi->openid_create: #{e}"
|
|
47
|
+
end
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Parameters
|
|
51
|
+
|
|
52
|
+
Name | Type | Description | Notes
|
|
53
|
+
------------- | ------------- | ------------- | -------------
|
|
54
|
+
**owner** | **String**| |
|
|
55
|
+
**data** | [**OidcRequest**](OidcRequest.md)| | [optional]
|
|
56
|
+
|
|
57
|
+
### Return type
|
|
58
|
+
|
|
59
|
+
[**Oidc1**](Oidc1.md)
|
|
60
|
+
|
|
61
|
+
### Authorization
|
|
62
|
+
|
|
63
|
+
[apikey](../README.md#apikey), [basic](../README.md#basic)
|
|
64
|
+
|
|
65
|
+
### HTTP request headers
|
|
66
|
+
|
|
67
|
+
- **Content-Type**: application/json
|
|
68
|
+
- **Accept**: application/json
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Cloudsmith API (v1)
|
|
3
|
+
|
|
4
|
+
#The API to the Cloudsmith Service
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
Contact: support@cloudsmith.io
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.50
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'uri'
|
|
14
|
+
|
|
15
|
+
module CloudsmithApi
|
|
16
|
+
class OpenidApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Get a JWT token for a configured service account belonging to the requesting org.
|
|
23
|
+
# Get a JWT token for a configured service account belonging to the requesting org.
|
|
24
|
+
# @param owner
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [OidcRequest] :data
|
|
27
|
+
# @return [Oidc1]
|
|
28
|
+
def openid_create(owner, opts = {})
|
|
29
|
+
data, _status_code, _headers = openid_create_with_http_info(owner, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Get a JWT token for a configured service account belonging to the requesting org.
|
|
34
|
+
# Get a JWT token for a configured service account belonging to the requesting org.
|
|
35
|
+
# @param owner
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [OidcRequest] :data
|
|
38
|
+
# @return [Array<(Oidc1, Fixnum, Hash)>] Oidc1 data, response status code and response headers
|
|
39
|
+
def openid_create_with_http_info(owner, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: OpenidApi.openid_create ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'owner' is set
|
|
44
|
+
if @api_client.config.client_side_validation && owner.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'owner' when calling OpenidApi.openid_create"
|
|
46
|
+
end
|
|
47
|
+
# resource path
|
|
48
|
+
local_var_path = '/openid/{owner}/'.sub('{' + 'owner' + '}', owner.to_s)
|
|
49
|
+
|
|
50
|
+
# query parameters
|
|
51
|
+
query_params = {}
|
|
52
|
+
|
|
53
|
+
# header parameters
|
|
54
|
+
header_params = {}
|
|
55
|
+
# HTTP header 'Accept' (if needed)
|
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
57
|
+
# HTTP header 'Content-Type'
|
|
58
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
59
|
+
|
|
60
|
+
# form parameters
|
|
61
|
+
form_params = {}
|
|
62
|
+
|
|
63
|
+
# http body (model)
|
|
64
|
+
post_body = @api_client.object_to_http_body(opts[:'data'])
|
|
65
|
+
auth_names = ['apikey', 'basic']
|
|
66
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
67
|
+
:header_params => header_params,
|
|
68
|
+
:query_params => query_params,
|
|
69
|
+
:form_params => form_params,
|
|
70
|
+
:body => post_body,
|
|
71
|
+
:auth_names => auth_names,
|
|
72
|
+
:return_type => 'Oidc1')
|
|
73
|
+
if @api_client.config.debugging
|
|
74
|
+
@api_client.config.logger.debug "API called: OpenidApi#openid_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
75
|
+
end
|
|
76
|
+
return data, status_code, headers
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -18,7 +18,7 @@ class NixPackageUploadRequest
|
|
|
18
18
|
attr_accessor :is_malware_detected
|
|
19
19
|
|
|
20
20
|
# The narinfo sidecar metadata file (<storeHash>.narinfo). Optional — the package can be completed later by publishing the matching narinfo via the native HTTP PUT path.
|
|
21
|
-
attr_accessor :
|
|
21
|
+
attr_accessor :narinfo_file
|
|
22
22
|
|
|
23
23
|
# The primary file for the package.
|
|
24
24
|
attr_accessor :package_file
|
|
@@ -38,7 +38,7 @@ class NixPackageUploadRequest
|
|
|
38
38
|
def self.attribute_map
|
|
39
39
|
{
|
|
40
40
|
:'is_malware_detected' => :'is_malware_detected',
|
|
41
|
-
:'
|
|
41
|
+
:'narinfo_file' => :'narinfo_file',
|
|
42
42
|
:'package_file' => :'package_file',
|
|
43
43
|
:'republish' => :'republish',
|
|
44
44
|
:'tags' => :'tags',
|
|
@@ -51,7 +51,7 @@ class NixPackageUploadRequest
|
|
|
51
51
|
def self.swagger_types
|
|
52
52
|
{
|
|
53
53
|
:'is_malware_detected' => :'BOOLEAN',
|
|
54
|
-
:'
|
|
54
|
+
:'narinfo_file' => :'String',
|
|
55
55
|
:'package_file' => :'String',
|
|
56
56
|
:'republish' => :'BOOLEAN',
|
|
57
57
|
:'tags' => :'String',
|
|
@@ -72,8 +72,8 @@ class NixPackageUploadRequest
|
|
|
72
72
|
self.is_malware_detected = attributes[:'is_malware_detected']
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
if attributes.has_key?(:'
|
|
76
|
-
self.
|
|
75
|
+
if attributes.has_key?(:'narinfo_file')
|
|
76
|
+
self.narinfo_file = attributes[:'narinfo_file']
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
if attributes.has_key?(:'package_file')
|
|
@@ -121,7 +121,7 @@ class NixPackageUploadRequest
|
|
|
121
121
|
return true if self.equal?(o)
|
|
122
122
|
self.class == o.class &&
|
|
123
123
|
is_malware_detected == o.is_malware_detected &&
|
|
124
|
-
|
|
124
|
+
narinfo_file == o.narinfo_file &&
|
|
125
125
|
package_file == o.package_file &&
|
|
126
126
|
republish == o.republish &&
|
|
127
127
|
tags == o.tags &&
|
|
@@ -138,7 +138,7 @@ class NixPackageUploadRequest
|
|
|
138
138
|
# Calculates hash code according to all attributes.
|
|
139
139
|
# @return [Fixnum] Hash code
|
|
140
140
|
def hash
|
|
141
|
-
[is_malware_detected,
|
|
141
|
+
[is_malware_detected, narinfo_file, package_file, republish, tags, version, vulnerability_counts].hash
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
# Builds the object from hash
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Cloudsmith API (v1)
|
|
3
|
+
|
|
4
|
+
#The API to the Cloudsmith Service
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
Contact: support@cloudsmith.io
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.50
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module CloudsmithApi
|
|
16
|
+
class Oidc
|
|
17
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
18
|
+
def self.attribute_map
|
|
19
|
+
{
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Attribute type mapping.
|
|
24
|
+
def self.swagger_types
|
|
25
|
+
{
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Initializes the object
|
|
30
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
31
|
+
def initialize(attributes = {})
|
|
32
|
+
return unless attributes.is_a?(Hash)
|
|
33
|
+
|
|
34
|
+
# convert string to symbol for hash key
|
|
35
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
39
|
+
# @return Array for valid properties with the reasons
|
|
40
|
+
def list_invalid_properties
|
|
41
|
+
invalid_properties = Array.new
|
|
42
|
+
invalid_properties
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Check to see if the all the properties in the model are valid
|
|
46
|
+
# @return true if the model is valid
|
|
47
|
+
def valid?
|
|
48
|
+
true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Checks equality by comparing each attribute.
|
|
52
|
+
# @param [Object] Object to be compared
|
|
53
|
+
def ==(o)
|
|
54
|
+
return true if self.equal?(o)
|
|
55
|
+
self.class == o.class
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @see the `==` method
|
|
59
|
+
# @param [Object] Object to be compared
|
|
60
|
+
def eql?(o)
|
|
61
|
+
self == o
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Calculates hash code according to all attributes.
|
|
65
|
+
# @return [Fixnum] Hash code
|
|
66
|
+
def hash
|
|
67
|
+
[].hash
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Builds the object from hash
|
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
72
|
+
# @return [Object] Returns the model itself
|
|
73
|
+
def build_from_hash(attributes)
|
|
74
|
+
return nil unless attributes.is_a?(Hash)
|
|
75
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
76
|
+
if type =~ /\AArray<(.*)>/i
|
|
77
|
+
# check to ensure the input is an array given that the attribute
|
|
78
|
+
# is documented as an array but the input is not
|
|
79
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
80
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
81
|
+
end
|
|
82
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
83
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
84
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
self
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Deserializes the data based on type
|
|
91
|
+
# @param string type Data type
|
|
92
|
+
# @param string value Value to be deserialized
|
|
93
|
+
# @return [Object] Deserialized data
|
|
94
|
+
def _deserialize(type, value)
|
|
95
|
+
case type.to_sym
|
|
96
|
+
when :DateTime
|
|
97
|
+
DateTime.parse(value)
|
|
98
|
+
when :Date
|
|
99
|
+
Date.parse(value)
|
|
100
|
+
when :String
|
|
101
|
+
value.to_s
|
|
102
|
+
when :Integer
|
|
103
|
+
value.to_i
|
|
104
|
+
when :Float
|
|
105
|
+
value.to_f
|
|
106
|
+
when :BOOLEAN
|
|
107
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
108
|
+
true
|
|
109
|
+
else
|
|
110
|
+
false
|
|
111
|
+
end
|
|
112
|
+
when :Object
|
|
113
|
+
# generic object (usually a Hash), return directly
|
|
114
|
+
value
|
|
115
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
116
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
117
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
118
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
119
|
+
k_type = Regexp.last_match[:k_type]
|
|
120
|
+
v_type = Regexp.last_match[:v_type]
|
|
121
|
+
{}.tap do |hash|
|
|
122
|
+
value.each do |k, v|
|
|
123
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
else # model
|
|
127
|
+
temp_model = CloudsmithApi.const_get(type).new
|
|
128
|
+
temp_model.build_from_hash(value)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Returns the string representation of the object
|
|
133
|
+
# @return [String] String presentation of the object
|
|
134
|
+
def to_s
|
|
135
|
+
to_hash.to_s
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
139
|
+
# @return [Hash] Returns the object in the form of hash
|
|
140
|
+
def to_body
|
|
141
|
+
to_hash
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Returns the object in the form of hash
|
|
145
|
+
# @return [Hash] Returns the object in the form of hash
|
|
146
|
+
def to_hash
|
|
147
|
+
hash = {}
|
|
148
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
149
|
+
value = self.send(attr)
|
|
150
|
+
next if value.nil?
|
|
151
|
+
hash[param] = _to_hash(value)
|
|
152
|
+
end
|
|
153
|
+
hash
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Outputs non-array value in the form of hash
|
|
157
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
158
|
+
# @param [Object] value Any valid value
|
|
159
|
+
# @return [Hash] Returns the value in the form of hash
|
|
160
|
+
def _to_hash(value)
|
|
161
|
+
if value.is_a?(Array)
|
|
162
|
+
value.compact.map { |v| _to_hash(v) }
|
|
163
|
+
elsif value.is_a?(Hash)
|
|
164
|
+
{}.tap do |hash|
|
|
165
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
166
|
+
end
|
|
167
|
+
elsif value.respond_to? :to_hash
|
|
168
|
+
value.to_hash
|
|
169
|
+
else
|
|
170
|
+
value
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Cloudsmith API (v1)
|
|
3
|
+
|
|
4
|
+
#The API to the Cloudsmith Service
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
Contact: support@cloudsmith.io
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.50
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module CloudsmithApi
|
|
16
|
+
class Oidc1
|
|
17
|
+
# Serialized JWT to be used for authentication.
|
|
18
|
+
attr_accessor :token
|
|
19
|
+
|
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
|
+
def self.attribute_map
|
|
22
|
+
{
|
|
23
|
+
:'token' => :'token'
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Attribute type mapping.
|
|
28
|
+
def self.swagger_types
|
|
29
|
+
{
|
|
30
|
+
:'token' => :'String'
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Initializes the object
|
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
36
|
+
def initialize(attributes = {})
|
|
37
|
+
return unless attributes.is_a?(Hash)
|
|
38
|
+
|
|
39
|
+
# convert string to symbol for hash key
|
|
40
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
41
|
+
|
|
42
|
+
if attributes.has_key?(:'token')
|
|
43
|
+
self.token = attributes[:'token']
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
48
|
+
# @return Array for valid properties with the reasons
|
|
49
|
+
def list_invalid_properties
|
|
50
|
+
invalid_properties = Array.new
|
|
51
|
+
invalid_properties
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Check to see if the all the properties in the model are valid
|
|
55
|
+
# @return true if the model is valid
|
|
56
|
+
def valid?
|
|
57
|
+
true
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Checks equality by comparing each attribute.
|
|
61
|
+
# @param [Object] Object to be compared
|
|
62
|
+
def ==(o)
|
|
63
|
+
return true if self.equal?(o)
|
|
64
|
+
self.class == o.class &&
|
|
65
|
+
token == o.token
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @see the `==` method
|
|
69
|
+
# @param [Object] Object to be compared
|
|
70
|
+
def eql?(o)
|
|
71
|
+
self == o
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Calculates hash code according to all attributes.
|
|
75
|
+
# @return [Fixnum] Hash code
|
|
76
|
+
def hash
|
|
77
|
+
[token].hash
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Builds the object from hash
|
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
82
|
+
# @return [Object] Returns the model itself
|
|
83
|
+
def build_from_hash(attributes)
|
|
84
|
+
return nil unless attributes.is_a?(Hash)
|
|
85
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
86
|
+
if type =~ /\AArray<(.*)>/i
|
|
87
|
+
# check to ensure the input is an array given that the attribute
|
|
88
|
+
# is documented as an array but the input is not
|
|
89
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
90
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
91
|
+
end
|
|
92
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
93
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
94
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
self
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Deserializes the data based on type
|
|
101
|
+
# @param string type Data type
|
|
102
|
+
# @param string value Value to be deserialized
|
|
103
|
+
# @return [Object] Deserialized data
|
|
104
|
+
def _deserialize(type, value)
|
|
105
|
+
case type.to_sym
|
|
106
|
+
when :DateTime
|
|
107
|
+
DateTime.parse(value)
|
|
108
|
+
when :Date
|
|
109
|
+
Date.parse(value)
|
|
110
|
+
when :String
|
|
111
|
+
value.to_s
|
|
112
|
+
when :Integer
|
|
113
|
+
value.to_i
|
|
114
|
+
when :Float
|
|
115
|
+
value.to_f
|
|
116
|
+
when :BOOLEAN
|
|
117
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
118
|
+
true
|
|
119
|
+
else
|
|
120
|
+
false
|
|
121
|
+
end
|
|
122
|
+
when :Object
|
|
123
|
+
# generic object (usually a Hash), return directly
|
|
124
|
+
value
|
|
125
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
126
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
127
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
128
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
129
|
+
k_type = Regexp.last_match[:k_type]
|
|
130
|
+
v_type = Regexp.last_match[:v_type]
|
|
131
|
+
{}.tap do |hash|
|
|
132
|
+
value.each do |k, v|
|
|
133
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
else # model
|
|
137
|
+
temp_model = CloudsmithApi.const_get(type).new
|
|
138
|
+
temp_model.build_from_hash(value)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Returns the string representation of the object
|
|
143
|
+
# @return [String] String presentation of the object
|
|
144
|
+
def to_s
|
|
145
|
+
to_hash.to_s
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
149
|
+
# @return [Hash] Returns the object in the form of hash
|
|
150
|
+
def to_body
|
|
151
|
+
to_hash
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Returns the object in the form of hash
|
|
155
|
+
# @return [Hash] Returns the object in the form of hash
|
|
156
|
+
def to_hash
|
|
157
|
+
hash = {}
|
|
158
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
159
|
+
value = self.send(attr)
|
|
160
|
+
next if value.nil?
|
|
161
|
+
hash[param] = _to_hash(value)
|
|
162
|
+
end
|
|
163
|
+
hash
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Outputs non-array value in the form of hash
|
|
167
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
168
|
+
# @param [Object] value Any valid value
|
|
169
|
+
# @return [Hash] Returns the value in the form of hash
|
|
170
|
+
def _to_hash(value)
|
|
171
|
+
if value.is_a?(Array)
|
|
172
|
+
value.compact.map { |v| _to_hash(v) }
|
|
173
|
+
elsif value.is_a?(Hash)
|
|
174
|
+
{}.tap do |hash|
|
|
175
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
176
|
+
end
|
|
177
|
+
elsif value.respond_to? :to_hash
|
|
178
|
+
value.to_hash
|
|
179
|
+
else
|
|
180
|
+
value
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
end
|
|
185
|
+
end
|