All Files (55.3% covered at 16.96 hits/line)
20 files in total.
1763 relevant lines.
975 lines covered and
788 lines missed
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
# Common files
- 1
require 'crx_packmgr_api_client/api_client'
- 1
require 'crx_packmgr_api_client/api_error'
- 1
require 'crx_packmgr_api_client/version'
- 1
require 'crx_packmgr_api_client/configuration'
# Models
- 1
require 'crx_packmgr_api_client/models/filter'
- 1
require 'crx_packmgr_api_client/models/filter_rule'
- 1
require 'crx_packmgr_api_client/models/group'
- 1
require 'crx_packmgr_api_client/models/group_list'
- 1
require 'crx_packmgr_api_client/models/init_data'
- 1
require 'crx_packmgr_api_client/models/install_status'
- 1
require 'crx_packmgr_api_client/models/install_status_status'
- 1
require 'crx_packmgr_api_client/models/package'
- 1
require 'crx_packmgr_api_client/models/package_list'
- 1
require 'crx_packmgr_api_client/models/service_exec_response'
- 1
require 'crx_packmgr_api_client/models/service_response'
- 1
require 'crx_packmgr_api_client/models/service_response_request'
- 1
require 'crx_packmgr_api_client/models/service_response_request_param'
- 1
require 'crx_packmgr_api_client/models/service_response_response'
- 1
require 'crx_packmgr_api_client/models/update_status'
# APIs
- 1
require 'crx_packmgr_api_client/api/default_api'
- 1
module CrxPackageManager
- 1
class << self
# Customize default settings for the SDK using block.
# CrxPackageManager.configure do |config|
# config.username = "xxx"
# config.password = "xxx"
# end
# If no block given, return the default Configuration object.
- 1
def configure
- 6
if block_given?
- 6
yield(Configuration.default)
else
Configuration.default
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'uri'
- 1
module CrxPackageManager
- 1
class DefaultApi
- 1
attr_accessor :api_client
- 1
def initialize(api_client = ApiClient.default)
- 51
@api_client = api_client
end
# Download a package
# Downloads the package at the specified path. Returns a Tempfile object.
# @param [Hash] opts the optional parameters
# @option opts [String] :path The path to the package to download.
# @return [File]
- 1
def download(opts = {})
- 4
data, _status_code, _headers = download_with_http_info(opts)
- 3
data
end
# Download a package
# Downloads the package at the specified path. Returns a Tempfile object.
# @param [Hash] opts the optional parameters
# @option opts [String] :path The path to the package to download.
# @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
- 1
def download_with_http_info(opts = {})
- 4
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.download ...'
end
# resource path
- 4
local_var_path = '/download.jsp'
# query parameters
- 4
query_params = {}
- 4
query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?
# header parameters
- 4
header_params = {}
# HTTP header 'Accept' (if needed)
- 4
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/zip'])
# form parameters
- 4
form_params = {}
# http body (model)
- 4
post_body = nil
- 4
auth_names = ['basic']
- 4
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'File')
- 3
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 3
return data, status_code, headers
end
# List package groups
# Returns a list of all package groups available.
# @param [Hash] opts the optional parameters
# @option opts [String] :compress_version Compress versions; count all versions of the same packages as a single entry.
# @option opts [BOOLEAN] :include_all Return a total count of all packages. Defaults to false.
# @option opts [BOOLEAN] :include_root Include the root package. Defaults to false.
# @option opts [BOOLEAN] :include_my_packages Include the 'my_packages' group. Only applicable if the group has no packages. Defaults to false.
# @option opts [BOOLEAN] :only_top_level Only list top-level groups, ie. do not list all nested groups.
# @return [GroupList]
- 1
def groups(opts = {})
- 9
data, _status_code, _headers = groups_with_http_info(opts)
- 8
data
end
# List package groups
# Returns a list of all package groups available.
# @param [Hash] opts the optional parameters
# @option opts [String] :compress_version Compress versions; count all versions of the same packages as a single entry.
# @option opts [BOOLEAN] :include_all Return a total count of all packages. Defaults to false.
# @option opts [BOOLEAN] :include_root Include the root package. Defaults to false.
# @option opts [BOOLEAN] :include_my_packages Include the 'my_packages' group. Only applicable if the group has no packages. Defaults to false.
# @option opts [BOOLEAN] :only_top_level Only list top-level groups, ie. do not list all nested groups.
# @return [Array<(GroupList, Fixnum, Hash)>] GroupList data, response status code and response headers
- 1
def groups_with_http_info(opts = {})
- 9
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.groups ...'
end
# resource path
- 9
local_var_path = '/groups.jsp'
# query parameters
- 9
query_params = {}
- 9
query_params[:'compressVersion'] = opts[:'compress_version'] if !opts[:'compress_version'].nil?
- 9
query_params[:'includeAll'] = opts[:'include_all'] if !opts[:'include_all'].nil?
- 9
query_params[:'includeRoot'] = opts[:'include_root'] if !opts[:'include_root'].nil?
- 9
query_params[:'includeMyPackages'] = opts[:'include_my_packages'] if !opts[:'include_my_packages'].nil?
- 9
query_params[:'onlyTopLevel'] = opts[:'only_top_level'] if !opts[:'only_top_level'].nil?
# header parameters
- 9
header_params = {}
# HTTP header 'Accept' (if needed)
- 9
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
- 9
form_params = {}
# http body (model)
- 9
post_body = nil
- 9
auth_names = ['basic']
- 9
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'GroupList')
- 8
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 8
return data, status_code, headers
end
# Metadata
# Display metadata about this package manager.
# @param [Hash] opts the optional parameters
# @return [InitData]
- 1
def init(opts = {})
- 4
data, _status_code, _headers = init_with_http_info(opts)
- 3
data
end
# Metadata
# Display metadata about this package manager.
# @param [Hash] opts the optional parameters
# @return [Array<(InitData, Fixnum, Hash)>] InitData data, response status code and response headers
- 1
def init_with_http_info(opts = {})
- 4
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.init ...'
end
# resource path
- 4
local_var_path = '/init.jsp'
# query parameters
- 4
query_params = {}
# header parameters
- 4
header_params = {}
# HTTP header 'Accept' (if needed)
- 4
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
- 4
form_params = {}
# http body (model)
- 4
post_body = nil
- 4
auth_names = ['basic']
- 4
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'InitData')
- 3
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#init\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 3
return data, status_code, headers
end
# Package Installation Status
# Returns a status of the installation of OSGi packages.
# @param [Hash] opts the optional parameters
# @return [InstallStatus]
- 1
def installstatus(opts = {})
- 4
data, _status_code, _headers = installstatus_with_http_info(opts)
- 3
data
end
# Package Installation Status
# Returns a status of the installation of OSGi packages.
# @param [Hash] opts the optional parameters
# @return [Array<(InstallStatus, Fixnum, Hash)>] InstallStatus data, response status code and response headers
- 1
def installstatus_with_http_info(opts = {})
- 4
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.installstatus ...'
end
# resource path
- 4
local_var_path = '/installstatus.jsp'
# query parameters
- 4
query_params = {}
# header parameters
- 4
header_params = {}
# HTTP header 'Accept' (if needed)
- 4
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
- 4
form_params = {}
# http body (model)
- 4
post_body = nil
- 4
auth_names = ['basic']
- 4
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'InstallStatus')
- 3
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#installstatus\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 3
return data, status_code, headers
end
# List packages
# Returns a list of all available packages defined.
# @param [Hash] opts the optional parameters
# @option opts [String] :q Term to search within package names.
# @option opts [BOOLEAN] :include_versions Include versions of package in results.
# @option opts [String] :path The path to a specific package definition.
# @return [PackageList]
- 1
def list(opts = {})
- 6
data, _status_code, _headers = list_with_http_info(opts)
- 5
data
end
# List packages
# Returns a list of all available packages defined.
# @param [Hash] opts the optional parameters
# @option opts [String] :q Term to search within package names.
# @option opts [BOOLEAN] :include_versions Include versions of package in results.
# @option opts [String] :path The path to a specific package definition.
# @return [Array<(PackageList, Fixnum, Hash)>] PackageList data, response status code and response headers
- 1
def list_with_http_info(opts = {})
- 6
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.list ...'
end
# resource path
- 6
local_var_path = '/list.jsp'
# query parameters
- 6
query_params = {}
- 6
query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
- 6
query_params[:'includeVersions'] = opts[:'include_versions'] if !opts[:'include_versions'].nil?
- 6
query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?
# header parameters
- 6
header_params = {}
# HTTP header 'Accept' (if needed)
- 6
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
- 6
form_params = {}
# http body (model)
- 6
post_body = nil
- 6
auth_names = ['basic']
- 6
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'PackageList')
- 5
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 5
return data, status_code, headers
end
# Get screenshot
# Returns the screenshot at the specified path.
# @param [Hash] opts the optional parameters
# @option opts [String] :path The path to the screenshot.
# @return [File]
- 1
def screenshot(opts = {})
- 4
data, _status_code, _headers = screenshot_with_http_info(opts)
- 3
data
end
# Get screenshot
# Returns the screenshot at the specified path.
# @param [Hash] opts the optional parameters
# @option opts [String] :path The path to the screenshot.
# @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
- 1
def screenshot_with_http_info(opts = {})
- 4
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.screenshot ...'
end
# resource path
- 4
local_var_path = '/screenshot.jsp'
# query parameters
- 4
query_params = {}
- 4
query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?
# header parameters
- 4
header_params = {}
# HTTP header 'Accept' (if needed)
- 4
header_params['Accept'] = @api_client.select_header_accept(['image/jpg', 'image/jpeg', 'image/png'])
# form parameters
- 4
form_params = {}
# http body (model)
- 4
post_body = nil
- 4
auth_names = ['basic']
- 4
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'File')
- 3
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#screenshot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 3
return data, status_code, headers
end
# Generic operation service.
# Provides a different API for executing package manipulation commands. Operates on a specific version of the package.
# @param cmd The command to execute.
# @param name The name of the package on which to execute the command.
# @param group The group of the package on which to execute the command.
# @param version The version of the package on which to execute the command.
# @param [Hash] opts the optional parameters
# @return [ServiceExecResponse]
- 1
def service_exec(cmd, name, group, version, opts = {})
data, _status_code, _headers = service_exec_with_http_info(cmd, name, group, version, opts)
data
end
# Generic operation service.
# Provides a different API for executing package manipulation commands. Operates on a specific version of the package.
# @param cmd The command to execute.
# @param name The name of the package on which to execute the command.
# @param group The group of the package on which to execute the command.
# @param version The version of the package on which to execute the command.
# @param [Hash] opts the optional parameters
# @return [Array<(ServiceExecResponse, Fixnum, Hash)>] ServiceExecResponse data, response status code and response headers
- 1
def service_exec_with_http_info(cmd, name, group, version, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.service_exec ...'
end
# verify the required parameter 'cmd' is set
if @api_client.config.client_side_validation && cmd.nil?
fail ArgumentError, "Missing the required parameter 'cmd' when calling DefaultApi.service_exec"
end
# verify enum value
if @api_client.config.client_side_validation && !['build', 'install', 'delete', 'uninstall', 'dryrun', 'replicate'].include?(cmd)
fail ArgumentError, "invalid value for 'cmd', must be one of build, install, delete, uninstall, dryrun, replicate"
end
# verify the required parameter 'name' is set
if @api_client.config.client_side_validation && name.nil?
fail ArgumentError, "Missing the required parameter 'name' when calling DefaultApi.service_exec"
end
# verify the required parameter 'group' is set
if @api_client.config.client_side_validation && group.nil?
fail ArgumentError, "Missing the required parameter 'group' when calling DefaultApi.service_exec"
end
# verify the required parameter 'version' is set
if @api_client.config.client_side_validation && version.nil?
fail ArgumentError, "Missing the required parameter 'version' when calling DefaultApi.service_exec"
end
# resource path
local_var_path = '/service/exec.json/etc/packages/{group}/{name}-{version}.zip'.sub('{' + 'name' + '}', name.to_s).sub('{' + 'group' + '}', group.to_s).sub('{' + 'version' + '}', version.to_s)
# query parameters
query_params = {}
query_params[:'cmd'] = cmd
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['basic']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ServiceExecResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#service_exec\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Generic operation service.
# Provides endpoint for executing package manipulation commands. Responses are in the format of the ServiceResponse in the defintions section.
# @param cmd The command to execute.
# @param [Hash] opts the optional parameters
# @option opts [String] :name The name of the package on which to execute the command.
# @option opts [String] :group The group of the package on which to execute the command.
# @option opts [BOOLEAN] :strict Fail on an error.
# @return [String]
- 1
def service_get(cmd, opts = {})
- 11
data, _status_code, _headers = service_get_with_http_info(cmd, opts)
- 9
data
end
# Generic operation service.
# Provides endpoint for executing package manipulation commands. Responses are in the format of the ServiceResponse in the defintions section.
# @param cmd The command to execute.
# @param [Hash] opts the optional parameters
# @option opts [String] :name The name of the package on which to execute the command.
# @option opts [String] :group The group of the package on which to execute the command.
# @option opts [BOOLEAN] :strict Fail on an error.
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
- 1
def service_get_with_http_info(cmd, opts = {})
- 11
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.service_get ...'
end
# verify the required parameter 'cmd' is set
- 11
if @api_client.config.client_side_validation && cmd.nil?
fail ArgumentError, "Missing the required parameter 'cmd' when calling DefaultApi.service_get"
end
# verify enum value
- 11
if @api_client.config.client_side_validation && !['help', 'ls', 'rm', 'build', 'inst', 'uninst', 'get'].include?(cmd)
- 1
fail ArgumentError, "invalid value for 'cmd', must be one of help, ls, rm, build, inst, uninst, get"
end
# resource path
- 10
local_var_path = '/service.jsp'
# query parameters
- 10
query_params = {}
- 10
query_params[:'cmd'] = cmd
- 10
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
- 10
query_params[:'group'] = opts[:'group'] if !opts[:'group'].nil?
- 10
query_params[:'strict'] = opts[:'strict'] if !opts[:'strict'].nil?
# header parameters
- 10
header_params = {}
# HTTP header 'Accept' (if needed)
- 10
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/zip', 'text/plain'])
# form parameters
- 10
form_params = {}
# http body (model)
- 10
post_body = nil
- 10
auth_names = ['basic']
- 10
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'String')
- 9
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#service_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 9
return data, status_code, headers
end
# Generic operation service.
# Provides endpoint for executing package manipulation commands. Responses are in the format of the ServiceResponse in the defintions section.
# @param file Package file to upload
# @param [Hash] opts the optional parameters
# @option opts [String] :name The hint for the package's name if the definiton doesn't have one.
# @option opts [BOOLEAN] :strict Fail on an error.
# @option opts [BOOLEAN] :force Force the package upload.
# @option opts [BOOLEAN] :install Install the package upon upload
# @return [String]
- 1
def service_post(file, opts = {})
- 4
data, _status_code, _headers = service_post_with_http_info(file, opts)
- 2
data
end
# Generic operation service.
# Provides endpoint for executing package manipulation commands. Responses are in the format of the ServiceResponse in the defintions section.
# @param file Package file to upload
# @param [Hash] opts the optional parameters
# @option opts [String] :name The hint for the package's name if the definiton doesn't have one.
# @option opts [BOOLEAN] :strict Fail on an error.
# @option opts [BOOLEAN] :force Force the package upload.
# @option opts [BOOLEAN] :install Install the package upon upload
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
- 1
def service_post_with_http_info(file, opts = {})
- 4
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.service_post ...'
end
# verify the required parameter 'file' is set
- 4
if @api_client.config.client_side_validation && file.nil?
- 1
fail ArgumentError, "Missing the required parameter 'file' when calling DefaultApi.service_post"
end
# resource path
- 3
local_var_path = '/service.jsp'
# query parameters
- 3
query_params = {}
# header parameters
- 3
header_params = {}
# HTTP header 'Content-Type'
- 3
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
# form parameters
- 3
form_params = {}
- 3
form_params['file'] = file
- 3
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
- 3
form_params['strict'] = opts[:'strict'] if !opts[:'strict'].nil?
- 3
form_params['force'] = opts[:'force'] if !opts[:'force'].nil?
- 3
form_params['install'] = opts[:'install'] if !opts[:'install'].nil?
# http body (model)
- 3
post_body = nil
- 3
auth_names = ['basic']
- 3
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'String')
- 2
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#service_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 2
return data, status_code, headers
end
# Get package thumbnail
# Returns the package's thumbnail image.
# @param [Hash] opts the optional parameters
# @option opts [String] :path The path to the package.
# @return [File]
- 1
def thumbnail(opts = {})
- 4
data, _status_code, _headers = thumbnail_with_http_info(opts)
- 3
data
end
# Get package thumbnail
# Returns the package's thumbnail image.
# @param [Hash] opts the optional parameters
# @option opts [String] :path The path to the package.
# @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
- 1
def thumbnail_with_http_info(opts = {})
- 4
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DefaultApi.thumbnail ...'
end
# resource path
- 4
local_var_path = '/thumbnail.jsp'
# query parameters
- 4
query_params = {}
- 4
query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?
# header parameters
- 4
header_params = {}
# HTTP header 'Accept' (if needed)
- 4
header_params['Accept'] = @api_client.select_header_accept(['image/jpg', 'image/jpeg', 'image/png'])
# form parameters
- 4
form_params = {}
# http body (model)
- 4
post_body = nil
- 4
auth_names = ['basic']
- 4
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'File')
- 3
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DefaultApi#thumbnail\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
- 3
return data, status_code, headers
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
require 'json'
- 1
require 'logger'
- 1
require 'tempfile'
- 1
require 'typhoeus'
- 1
require 'uri'
- 1
module CrxPackageManager
- 1
class ApiClient
# The Configuration object holding settings to be used in the API client.
- 1
attr_accessor :config
# Defines the headers to be used in HTTP requests of all API calls by default.
#
# @return [Hash]
- 1
attr_accessor :default_headers
# Initializes the ApiClient
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
- 1
def initialize(config = Configuration.default)
- 68
@config = config
- 68
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
- 68
@default_headers = {
'Content-Type' => 'application/json',
'User-Agent' => @user_agent
}
end
- 1
def self.default
- 2
@@default ||= ApiClient.new
end
# Call an API with given options.
#
# @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
# the data deserialized from response body (could be nil), response status code and response headers.
- 1
def call_api(http_method, path, opts = {})
- 48
request = build_request(http_method, path, opts)
- 48
response = request.run
- 48
if @config.debugging
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
end
- 48
unless response.success?
- 9
if response.timed_out?
fail ApiError.new('Connection timed out')
- 9
elsif response.code == 0
# Errors from libcurl will be made visible here
fail ApiError.new(:code => 0,
:message => response.return_message)
else
- 9
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_body => response.body),
response.status_message
end
end
- 39
if opts[:return_type]
- 39
data = deserialize(response, opts[:return_type])
else
data = nil
end
- 39
return data, response.code, response.headers
end
# Builds the HTTP request
#
# @param [String] http_method HTTP method/verb (e.g. POST)
# @param [String] path URL path (e.g. /account/new)
# @option opts [Hash] :header_params Header parameters
# @option opts [Hash] :query_params Query parameters
# @option opts [Hash] :form_params Query parameters
# @option opts [Object] :body HTTP body (JSON/XML)
# @return [Typhoeus::Request] A Typhoeus Request
- 1
def build_request(http_method, path, opts = {})
- 52
url = build_request_url(path)
- 52
http_method = http_method.to_sym.downcase
- 52
header_params = @default_headers.merge(opts[:header_params] || {})
- 52
query_params = opts[:query_params] || {}
- 52
form_params = opts[:form_params] || {}
- 52
update_params_for_auth! header_params, query_params, opts[:auth_names]
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
- 52
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
- 52
req_opts = {
:method => http_method,
:headers => header_params,
:params => query_params,
:params_encoding => @config.params_encoding,
:timeout => @config.timeout,
:ssl_verifypeer => @config.verify_ssl,
:ssl_verifyhost => _verify_ssl_host,
:sslcert => @config.cert_file,
:sslkey => @config.key_file,
:verbose => @config.debugging
}
# set custom cert, if provided
- 52
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
- 52
if [:post, :patch, :put, :delete].include?(http_method)
- 3
req_body = build_request_body(header_params, form_params, opts[:body])
- 3
req_opts.update :body => req_body
- 3
if @config.debugging
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
end
end
- 52
request = Typhoeus::Request.new(url, req_opts)
- 52
download_file(request) if opts[:return_type] == 'File'
- 52
request
end
# Check if the given MIME is a JSON MIME.
# JSON MIME examples:
# application/json
# application/json; charset=UTF8
# APPLICATION/JSON
# */*
# @param [String] mime MIME
# @return [Boolean] True if the MIME is application/json
- 1
def json_mime?(mime)
- 132
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
end
# Deserialize the response to the given return type.
#
# @param [Response] response HTTP response
# @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
- 1
def deserialize(response, return_type)
- 42
body = response.body
# handle file downloading - return the File instance processed in request callbacks
# note that response body is empty when the file is written in chunks in request on_body callback
- 42
return @tempfile if return_type == 'File'
- 33
return nil if body.nil? || body.empty?
# return response body directly for String return type
- 33
return body if return_type == 'String'
# ensuring a default content type
- 22
content_type = response.headers['Content-Type'] || 'application/json'
- 22
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
- 22
begin
- 22
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
rescue JSON::ParserError => e
if %w(String Date DateTime).include?(return_type)
data = body
else
raise e
end
end
- 22
convert_to_type data, return_type
end
# Convert data to the given return type.
# @param [Object] data Data to be converted
# @param [String] return_type Return type
# @return [Mixed] Data in a particular type
- 1
def convert_to_type(data, return_type)
- 30
return nil if data.nil?
- 30
case return_type
when 'String'
- 1
data.to_s
when 'Integer'
- 5
data.to_i
when 'Float'
data.to_f
when 'BOOLEAN'
data == true
when 'DateTime'
# parse date time (expecting ISO 8601 format)
DateTime.parse data
when 'Date'
# parse date time (expecting ISO 8601 format)
Date.parse data
when 'Object'
# generic object (usually a Hash), return directly
data
when /\AArray<(.+)>\z/
# e.g. Array<Pet>
- 4
sub_type = $1
- 11
data.map { |item| convert_to_type(item, sub_type) }
when /\AHash\<String, (.+)\>\z/
# e.g. Hash<String, Integer>
- 1
sub_type = $1
- 1
{}.tap do |hash|
- 2
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
end
else
# models, e.g. Pet
- 19
CrxPackageManager.const_get(return_type).new.tap do |model|
- 19
model.build_from_hash data
end
end
end
# Save response body into a file in (the defined) temporary folder, using the filename
# from the "Content-Disposition" header if provided, otherwise a random filename.
# The response body is written to the file in chunks in order to handle files which
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
# process can use.
#
# @see Configuration#temp_folder_path
- 1
def download_file(request)
- 12
tempfile = nil
- 12
encoding = nil
- 12
request.on_headers do |response|
- 12
content_disposition = response.headers['Content-Disposition']
- 12
if content_disposition && content_disposition =~ /filename=/i
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
prefix = sanitize_filename(filename)
else
- 12
prefix = 'download-'
end
- 12
prefix = prefix + '-' unless prefix.end_with?('-')
- 12
encoding = response.body.encoding
- 12
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
- 12
@tempfile = tempfile
end
- 12
request.on_body do |chunk|
- 12
chunk.force_encoding(encoding)
- 12
tempfile.write(chunk)
end
- 12
request.on_complete do |response|
- 12
tempfile.close
- 12
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
"explicitly with `tempfile.delete`"
end
end
# Sanitize filename by removing path.
# e.g. ../../sun.gif becomes sun.gif
#
# @param [String] filename the filename to be sanitized
# @return [String] the sanitized filename
- 1
def sanitize_filename(filename)
- 9
filename.gsub(/.*[\/\\]/, '')
end
- 1
def build_request_url(path)
# Add leading and trailing slashes to path
- 52
path = "/#{path}".gsub(/\/+/, '/')
- 52
URI.encode(@config.base_url + path)
end
# Builds the HTTP request body
#
# @param [Hash] header_params Header parameters
# @param [Hash] form_params Query parameters
# @param [Object] body HTTP body (JSON/XML)
# @return [String] HTTP body data in the form of string
- 1
def build_request_body(header_params, form_params, body)
# http form
- 3
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
header_params['Content-Type'] == 'multipart/form-data'
- 3
data = {}
- 3
form_params.each do |key, value|
- 3
case value
when ::File, ::Array, nil
# let typhoeus handle File, Array and nil parameters
- 3
data[key] = value
else
data[key] = value.to_s
end
end
elsif body
data = body.is_a?(String) ? body : body.to_json
else
data = nil
end
- 3
data
end
# Update hearder and query params based on authentication settings.
#
# @param [Hash] header_params Header parameters
# @param [Hash] query_params Query parameters
# @param [String] auth_names Authentication scheme name
- 1
def update_params_for_auth!(header_params, query_params, auth_names)
- 52
Array(auth_names).each do |auth_name|
- 48
auth_setting = @config.auth_settings[auth_name]
- 48
next unless auth_setting
- 48
case auth_setting[:in]
- 48
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
end
end
end
# Sets user agent in HTTP header
#
# @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
- 1
def user_agent=(user_agent)
@user_agent = user_agent
@default_headers['User-Agent'] = @user_agent
end
# Return Accept header based on an array of accepts provided.
# @param [Array] accepts array for Accept
# @return [String] the Accept header (e.g. application/json)
- 1
def select_header_accept(accepts)
- 52
return nil if accepts.nil? || accepts.empty?
# use JSON when present, otherwise use all of the provided
- 142
json_accept = accepts.find { |s| json_mime?(s) }
- 50
json_accept || accepts.join(',')
end
# Return Content-Type header based on an array of content types provided.
# @param [Array] content_types array for Content-Type
# @return [String] the Content-Type header (e.g. application/json)
- 1
def select_header_content_type(content_types)
# use application/json by default
- 10
return 'application/json' if content_types.nil? || content_types.empty?
# use JSON when present, otherwise use the first one
- 18
json_content_type = content_types.find { |s| json_mime?(s) }
- 8
json_content_type || content_types.first
end
# Convert object (array, hash, object, etc) to JSON string.
# @param [Object] model object to be converted into JSON string
# @return [String] JSON string representation of the object
- 1
def object_to_http_body(model)
return model if model.nil? || model.is_a?(String)
local_body = nil
if model.is_a?(Array)
local_body = model.map { |m| object_to_hash(m) }
else
local_body = object_to_hash(model)
end
local_body.to_json
end
# Convert object(non-array) to hash.
# @param [Object] obj object to be converted into JSON string
# @return [String] JSON string representation of the object
- 1
def object_to_hash(obj)
if obj.respond_to?(:to_hash)
obj.to_hash
else
obj
end
end
# Build parameter value according to the given collection format.
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
- 1
def build_collection_param(param, collection_format)
- 6
case collection_format
when :csv
- 1
param.join(',')
when :ssv
- 1
param.join(' ')
when :tsv
- 1
param.join("\t")
when :pipes
- 1
param.join('|')
when :multi
# return the array directly as typhoeus will handle it as expected
- 1
param
else
- 1
fail "unknown collection format: #{collection_format.inspect}"
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
module CrxPackageManager
- 1
class ApiError < StandardError
- 1
attr_reader :code, :response_headers, :response_body
# Usage examples:
# ApiError.new
# ApiError.new("message")
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
# ApiError.new(:code => 404, :message => "Not Found")
- 1
def initialize(arg = nil)
- 9
if arg.is_a? Hash
- 9
if arg.key?(:message) || arg.key?('message')
super(arg[:message] || arg['message'])
else
- 9
super arg
end
- 9
arg.each do |k, v|
- 27
instance_variable_set "@#{k}", v
end
else
super arg
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'uri'
- 1
module CrxPackageManager
- 1
class Configuration
# Defines url scheme
- 1
attr_accessor :scheme
# Defines url host
- 1
attr_accessor :host
# Defines url base path
- 1
attr_accessor :base_path
# Defines API keys used with API Key authentications.
#
# @return [Hash] key: parameter name, value: parameter value (API key)
#
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
# config.api_key['api_key'] = 'xxx'
- 1
attr_accessor :api_key
# Defines API key prefixes used with API Key authentications.
#
# @return [Hash] key: parameter name, value: API key prefix
#
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
# config.api_key_prefix['api_key'] = 'Token'
- 1
attr_accessor :api_key_prefix
# Defines the username used with HTTP basic authentication.
#
# @return [String]
- 1
attr_accessor :username
# Defines the password used with HTTP basic authentication.
#
# @return [String]
- 1
attr_accessor :password
# Defines the access token (Bearer) used with OAuth2.
- 1
attr_accessor :access_token
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
# details will be logged with `logger.debug` (see the `logger` attribute).
# Default to false.
#
# @return [true, false]
- 1
attr_accessor :debugging
# Defines the logger used for debugging.
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
#
# @return [#debug]
- 1
attr_accessor :logger
# Defines the temporary folder to store downloaded files
# (for API endpoints that have file response).
# Default to use `Tempfile`.
#
# @return [String]
- 1
attr_accessor :temp_folder_path
# The time limit for HTTP request in seconds.
# Default to 0 (never times out).
- 1
attr_accessor :timeout
# Set this to false to skip client side validation in the operation.
# Default to true.
# @return [true, false]
- 1
attr_accessor :client_side_validation
### TLS/SSL setting
# Set this to false to skip verifying SSL certificate when calling API from https server.
# Default to true.
#
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
#
# @return [true, false]
- 1
attr_accessor :verify_ssl
### TLS/SSL setting
# Set this to false to skip verifying SSL host name
# Default to true.
#
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
#
# @return [true, false]
- 1
attr_accessor :verify_ssl_host
### TLS/SSL setting
# Set this to customize the certificate file to verify the peer.
#
# @return [String] the path to the certificate file
#
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
- 1
attr_accessor :ssl_ca_cert
### TLS/SSL setting
# Client certificate file (for client certificate)
- 1
attr_accessor :cert_file
### TLS/SSL setting
# Client private key file (for client certificate)
- 1
attr_accessor :key_file
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
# Default to nil.
#
# @see The params_encoding option of Ethon. Related source code:
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
- 1
attr_accessor :params_encoding
- 1
attr_accessor :inject_format
- 1
attr_accessor :force_ending_format
- 1
def initialize
- 55
@scheme = 'http'
- 55
@host = 'localhost:4502'
- 55
@base_path = '/crx/packmgr'
- 55
@api_key = {}
- 55
@api_key_prefix = {}
- 55
@timeout = 0
- 55
@client_side_validation = true
- 55
@verify_ssl = true
- 55
@verify_ssl_host = true
- 55
@params_encoding = nil
- 55
@cert_file = nil
- 55
@key_file = nil
- 55
@debugging = false
- 55
@inject_format = false
- 55
@force_ending_format = false
- 55
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
- 55
yield(self) if block_given?
end
# The default Configuration object.
- 1
def self.default
- 28
@@default ||= Configuration.new
end
- 1
def configure
- 9
yield(self) if block_given?
end
- 1
def scheme=(scheme)
# remove :// from scheme
- 9
@scheme = scheme.sub(/:\/\//, '')
end
- 1
def host=(host)
# remove http(s):// and anything after a slash
- 12
@host = host.sub(/https?:\/\//, '').split('/').first
end
- 1
def base_path=(base_path)
# Add leading and trailing slashes to base_path
- 16
@base_path = "/#{base_path}".gsub(/\/+/, '/')
- 16
@base_path = '' if @base_path == '/'
end
- 1
def base_url
- 52
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
- 52
URI.encode(url)
end
# Gets API key (with prefix if set).
# @param [String] param_name the parameter name of API key auth
- 1
def api_key_with_prefix(param_name)
if @api_key_prefix[param_name]
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
else
@api_key[param_name]
end
end
# Gets Basic Auth token string
- 1
def basic_auth_token
- 48
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
end
# Returns Auth Settings hash for api client.
- 1
def auth_settings
- 48
{
'basic' =>
{
type: 'basic',
in: 'header',
key: 'Authorization',
value: basic_auth_token
},
}
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class Filter
- 1
attr_accessor :root
- 1
attr_accessor :rules
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 560
{
:'root' => :'root',
:'rules' => :'rules'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 140
{
:'root' => :'String',
:'rules' => :'Array<FilterRule>'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 143
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 143
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 143
if attributes.has_key?(:'root')
self.root = attributes[:'root']
end
- 143
if attributes.has_key?(:'rules')
if (value = attributes[:'rules']).is_a?(Array)
self.rules = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
root == o.root &&
rules == o.rules
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[root, rules].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 140
return nil unless attributes.is_a?(Hash)
- 140
self.class.swagger_types.each_pair do |key, type|
- 280
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
- 140
if attributes[self.class.attribute_map[key]].is_a?(Array)
- 490
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 140
elsif !attributes[self.class.attribute_map[key]].nil?
- 140
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 140
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 490
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
- 140
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- 350
temp_model = CrxPackageManager.const_get(type).new
- 350
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class FilterRule
- 1
attr_accessor :modifier
- 1
attr_accessor :pattern
- 1
class EnumAttributeValidator
- 1
attr_reader :datatype
- 1
attr_reader :allowable_values
- 1
def initialize(datatype, allowable_values)
- 350
@allowable_values = allowable_values.map do |value|
- 700
case datatype.to_s
when /Integer/i
value.to_i
when /Float/i
value.to_f
else
- 700
value
end
end
end
- 1
def valid?(value)
- 350
!value || allowable_values.include?(value)
end
end
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 1400
{
:'modifier' => :'modifier',
:'pattern' => :'pattern'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 350
{
:'modifier' => :'String',
:'pattern' => :'String'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 353
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 353
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 353
if attributes.has_key?(:'modifier')
self.modifier = attributes[:'modifier']
end
- 353
if attributes.has_key?(:'pattern')
self.pattern = attributes[:'pattern']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
modifier_validator = EnumAttributeValidator.new('String', ['exclude', 'include'])
return false unless modifier_validator.valid?(@modifier)
true
end
# Custom attribute writer method checking allowed values (enum).
# @param [Object] modifier Object to be assigned
- 1
def modifier=(modifier)
- 350
validator = EnumAttributeValidator.new('String', ['exclude', 'include'])
- 350
unless validator.valid?(modifier)
fail ArgumentError, 'invalid value for "modifier", must be one of #{validator.allowable_values}.'
end
- 350
@modifier = modifier
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
modifier == o.modifier &&
pattern == o.pattern
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[modifier, pattern].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 350
return nil unless attributes.is_a?(Hash)
- 350
self.class.swagger_types.each_pair do |key, type|
- 700
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 700
elsif !attributes[self.class.attribute_map[key]].nil?
- 700
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 350
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 700
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
- 700
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class Group
- 1
attr_accessor :name
- 1
attr_accessor :title
- 1
attr_accessor :count
- 1
attr_accessor :deep_count
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 192
{
:'name' => :'name',
:'title' => :'title',
:'count' => :'count',
:'deep_count' => :'deepCount'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 24
{
:'name' => :'String',
:'title' => :'String',
:'count' => :'Integer',
:'deep_count' => :'Integer'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 29
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 29
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 29
if attributes.has_key?(:'name')
self.name = attributes[:'name']
end
- 29
if attributes.has_key?(:'title')
self.title = attributes[:'title']
end
- 29
if attributes.has_key?(:'count')
self.count = attributes[:'count']
end
- 29
if attributes.has_key?(:'deepCount')
self.deep_count = attributes[:'deepCount']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
name == o.name &&
title == o.title &&
count == o.count &&
deep_count == o.deep_count
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[name, title, count, deep_count].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 24
return nil unless attributes.is_a?(Hash)
- 24
self.class.swagger_types.each_pair do |key, type|
- 96
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 96
elsif !attributes[self.class.attribute_map[key]].nil?
- 96
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 24
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 96
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
- 48
value.to_s
when :Integer
- 48
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class GroupList
- 1
attr_accessor :groups
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 16
{
:'groups' => :'groups'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 8
{
:'groups' => :'Array<Group>'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 10
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 10
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 10
if attributes.has_key?(:'groups')
if (value = attributes[:'groups']).is_a?(Array)
self.groups = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
groups == o.groups
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[groups].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 8
return nil unless attributes.is_a?(Hash)
- 8
self.class.swagger_types.each_pair do |key, type|
- 8
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
- 8
if attributes[self.class.attribute_map[key]].is_a?(Array)
- 32
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 8
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 24
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- 24
temp_model = CrxPackageManager.const_get(type).new
- 24
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class InitData
- 1
attr_accessor :context_path
- 1
attr_accessor :launchpad_context_path
- 1
attr_accessor :jcr_version
- 1
attr_accessor :workspace
- 1
attr_accessor :user_id
- 1
attr_accessor :workspaces
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 36
{
:'context_path' => :'contextPath',
:'launchpad_context_path' => :'launchpadContextPath',
:'jcr_version' => :'jcrVersion',
:'workspace' => :'workspace',
:'user_id' => :'userID',
:'workspaces' => :'workspaces'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 3
{
:'context_path' => :'String',
:'launchpad_context_path' => :'String',
:'jcr_version' => :'String',
:'workspace' => :'String',
:'user_id' => :'String',
:'workspaces' => :'Array<String>'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 10
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 10
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 10
if attributes.has_key?(:'contextPath')
self.context_path = attributes[:'contextPath']
end
- 10
if attributes.has_key?(:'launchpadContextPath')
self.launchpad_context_path = attributes[:'launchpadContextPath']
end
- 10
if attributes.has_key?(:'jcrVersion')
self.jcr_version = attributes[:'jcrVersion']
end
- 10
if attributes.has_key?(:'workspace')
self.workspace = attributes[:'workspace']
end
- 10
if attributes.has_key?(:'userID')
self.user_id = attributes[:'userID']
end
- 10
if attributes.has_key?(:'workspaces')
if (value = attributes[:'workspaces']).is_a?(Array)
self.workspaces = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
context_path == o.context_path &&
launchpad_context_path == o.launchpad_context_path &&
jcr_version == o.jcr_version &&
workspace == o.workspace &&
user_id == o.user_id &&
workspaces == o.workspaces
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[context_path, launchpad_context_path, jcr_version, workspace, user_id, workspaces].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 3
return nil unless attributes.is_a?(Hash)
- 3
self.class.swagger_types.each_pair do |key, type|
- 18
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
- 3
if attributes[self.class.attribute_map[key]].is_a?(Array)
- 6
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 15
elsif !attributes[self.class.attribute_map[key]].nil?
- 15
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 3
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 18
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
- 18
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class InstallStatus
- 1
attr_accessor :status
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 6
{
:'status' => :'status'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 3
{
:'status' => :'InstallStatusStatus'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 5
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 5
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 5
if attributes.has_key?(:'status')
self.status = attributes[:'status']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
status == o.status
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[status].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 3
return nil unless attributes.is_a?(Hash)
- 3
self.class.swagger_types.each_pair do |key, type|
- 3
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 3
elsif !attributes[self.class.attribute_map[key]].nil?
- 3
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 3
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 3
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- 3
temp_model = CrxPackageManager.const_get(type).new
- 3
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class InstallStatusStatus
- 1
attr_accessor :finished
- 1
attr_accessor :item_count
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 12
{
:'finished' => :'finished',
:'item_count' => :'itemCount'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 3
{
:'finished' => :'BOOLEAN',
:'item_count' => :'Integer'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 6
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 6
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 6
if attributes.has_key?(:'finished')
self.finished = attributes[:'finished']
end
- 6
if attributes.has_key?(:'itemCount')
self.item_count = attributes[:'itemCount']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
finished == o.finished &&
item_count == o.item_count
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[finished, item_count].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 3
return nil unless attributes.is_a?(Hash)
- 3
self.class.swagger_types.each_pair do |key, type|
- 6
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 6
elsif !attributes[self.class.attribute_map[key]].nil?
- 6
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 3
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 6
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
- 3
value.to_i
when :Float
value.to_f
when :BOOLEAN
- 3
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- 3
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class Package
- 1
attr_accessor :pid
- 1
attr_accessor :path
- 1
attr_accessor :name
- 1
attr_accessor :download_name
- 1
attr_accessor :group
- 1
attr_accessor :group_title
- 1
attr_accessor :version
- 1
attr_accessor :description
- 1
attr_accessor :thumbnail
- 1
attr_accessor :build_count
- 1
attr_accessor :last_modified
- 1
attr_accessor :last_modified_by
- 1
attr_accessor :created
- 1
attr_accessor :create_by
- 1
attr_accessor :last_unpacked
- 1
attr_accessor :last_unpacked_by
- 1
attr_accessor :last_wrapped
- 1
attr_accessor :last_wrapped_by
- 1
attr_accessor :last_unwrapped
- 1
attr_accessor :last_unwrapped_by
- 1
attr_accessor :size
- 1
attr_accessor :has_snapshot
- 1
attr_accessor :needs_rewrap
- 1
attr_accessor :built_with
- 1
attr_accessor :tested_with
- 1
attr_accessor :fixed_bugs
- 1
attr_accessor :requires_root
- 1
attr_accessor :requires_restart
- 1
attr_accessor :ac_handling
- 1
attr_accessor :dependencies
- 1
attr_accessor :resolved
- 1
attr_accessor :filter
- 1
attr_accessor :screenshots
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 1175
{
:'pid' => :'pid',
:'path' => :'path',
:'name' => :'name',
:'download_name' => :'downloadName',
:'group' => :'group',
:'group_title' => :'groupTitle',
:'version' => :'version',
:'description' => :'description',
:'thumbnail' => :'thumbnail',
:'build_count' => :'buildCount',
:'last_modified' => :'lastModified',
:'last_modified_by' => :'lastModifiedBy',
:'created' => :'created',
:'create_by' => :'createBy',
:'last_unpacked' => :'lastUnpacked',
:'last_unpacked_by' => :'lastUnpackedBy',
:'last_wrapped' => :'lastWrapped',
:'last_wrapped_by' => :'lastWrappedBy',
:'last_unwrapped' => :'lastUnwrapped',
:'last_unwrapped_by' => :'lastUnwrappedBy',
:'size' => :'size',
:'has_snapshot' => :'hasSnapshot',
:'needs_rewrap' => :'needsRewrap',
:'built_with' => :'builtWith',
:'tested_with' => :'testedWith',
:'fixed_bugs' => :'fixedBugs',
:'requires_root' => :'requiresRoot',
:'requires_restart' => :'requiresRestart',
:'ac_handling' => :'acHandling',
:'dependencies' => :'dependencies',
:'resolved' => :'resolved',
:'filter' => :'filter',
:'screenshots' => :'screenshots'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 20
{
:'pid' => :'String',
:'path' => :'String',
:'name' => :'String',
:'download_name' => :'String',
:'group' => :'String',
:'group_title' => :'String',
:'version' => :'String',
:'description' => :'String',
:'thumbnail' => :'String',
:'build_count' => :'Integer',
:'last_modified' => :'Integer',
:'last_modified_by' => :'String',
:'created' => :'Integer',
:'create_by' => :'String',
:'last_unpacked' => :'Integer',
:'last_unpacked_by' => :'String',
:'last_wrapped' => :'Integer',
:'last_wrapped_by' => :'String',
:'last_unwrapped' => :'Integer',
:'last_unwrapped_by' => :'String',
:'size' => :'Integer',
:'has_snapshot' => :'BOOLEAN',
:'needs_rewrap' => :'BOOLEAN',
:'built_with' => :'String',
:'tested_with' => :'String',
:'fixed_bugs' => :'String',
:'requires_root' => :'BOOLEAN',
:'requires_restart' => :'BOOLEAN',
:'ac_handling' => :'String',
:'dependencies' => :'Array<String>',
:'resolved' => :'BOOLEAN',
:'filter' => :'Array<Filter>',
:'screenshots' => :'Array<String>'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 54
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 54
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 54
if attributes.has_key?(:'pid')
self.pid = attributes[:'pid']
end
- 54
if attributes.has_key?(:'path')
self.path = attributes[:'path']
end
- 54
if attributes.has_key?(:'name')
self.name = attributes[:'name']
end
- 54
if attributes.has_key?(:'downloadName')
self.download_name = attributes[:'downloadName']
end
- 54
if attributes.has_key?(:'group')
self.group = attributes[:'group']
end
- 54
if attributes.has_key?(:'groupTitle')
self.group_title = attributes[:'groupTitle']
end
- 54
if attributes.has_key?(:'version')
self.version = attributes[:'version']
end
- 54
if attributes.has_key?(:'description')
self.description = attributes[:'description']
end
- 54
if attributes.has_key?(:'thumbnail')
self.thumbnail = attributes[:'thumbnail']
end
- 54
if attributes.has_key?(:'buildCount')
self.build_count = attributes[:'buildCount']
end
- 54
if attributes.has_key?(:'lastModified')
self.last_modified = attributes[:'lastModified']
end
- 54
if attributes.has_key?(:'lastModifiedBy')
self.last_modified_by = attributes[:'lastModifiedBy']
end
- 54
if attributes.has_key?(:'created')
self.created = attributes[:'created']
end
- 54
if attributes.has_key?(:'createBy')
self.create_by = attributes[:'createBy']
end
- 54
if attributes.has_key?(:'lastUnpacked')
self.last_unpacked = attributes[:'lastUnpacked']
end
- 54
if attributes.has_key?(:'lastUnpackedBy')
self.last_unpacked_by = attributes[:'lastUnpackedBy']
end
- 54
if attributes.has_key?(:'lastWrapped')
self.last_wrapped = attributes[:'lastWrapped']
end
- 54
if attributes.has_key?(:'lastWrappedBy')
self.last_wrapped_by = attributes[:'lastWrappedBy']
end
- 54
if attributes.has_key?(:'lastUnwrapped')
self.last_unwrapped = attributes[:'lastUnwrapped']
end
- 54
if attributes.has_key?(:'lastUnwrappedBy')
self.last_unwrapped_by = attributes[:'lastUnwrappedBy']
end
- 54
if attributes.has_key?(:'size')
self.size = attributes[:'size']
end
- 54
if attributes.has_key?(:'hasSnapshot')
self.has_snapshot = attributes[:'hasSnapshot']
end
- 54
if attributes.has_key?(:'needsRewrap')
self.needs_rewrap = attributes[:'needsRewrap']
end
- 54
if attributes.has_key?(:'builtWith')
self.built_with = attributes[:'builtWith']
end
- 54
if attributes.has_key?(:'testedWith')
self.tested_with = attributes[:'testedWith']
end
- 54
if attributes.has_key?(:'fixedBugs')
self.fixed_bugs = attributes[:'fixedBugs']
end
- 54
if attributes.has_key?(:'requiresRoot')
self.requires_root = attributes[:'requiresRoot']
end
- 54
if attributes.has_key?(:'requiresRestart')
self.requires_restart = attributes[:'requiresRestart']
end
- 54
if attributes.has_key?(:'acHandling')
self.ac_handling = attributes[:'acHandling']
end
- 54
if attributes.has_key?(:'dependencies')
if (value = attributes[:'dependencies']).is_a?(Array)
self.dependencies = value
end
end
- 54
if attributes.has_key?(:'resolved')
self.resolved = attributes[:'resolved']
end
- 54
if attributes.has_key?(:'filter')
if (value = attributes[:'filter']).is_a?(Array)
self.filter = value
end
end
- 54
if attributes.has_key?(:'screenshots')
if (value = attributes[:'screenshots']).is_a?(Array)
self.screenshots = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
pid == o.pid &&
path == o.path &&
name == o.name &&
download_name == o.download_name &&
group == o.group &&
group_title == o.group_title &&
version == o.version &&
description == o.description &&
thumbnail == o.thumbnail &&
build_count == o.build_count &&
last_modified == o.last_modified &&
last_modified_by == o.last_modified_by &&
created == o.created &&
create_by == o.create_by &&
last_unpacked == o.last_unpacked &&
last_unpacked_by == o.last_unpacked_by &&
last_wrapped == o.last_wrapped &&
last_wrapped_by == o.last_wrapped_by &&
last_unwrapped == o.last_unwrapped &&
last_unwrapped_by == o.last_unwrapped_by &&
size == o.size &&
has_snapshot == o.has_snapshot &&
needs_rewrap == o.needs_rewrap &&
built_with == o.built_with &&
tested_with == o.tested_with &&
fixed_bugs == o.fixed_bugs &&
requires_root == o.requires_root &&
requires_restart == o.requires_restart &&
ac_handling == o.ac_handling &&
dependencies == o.dependencies &&
resolved == o.resolved &&
filter == o.filter &&
screenshots == o.screenshots
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[pid, path, name, download_name, group, group_title, version, description, thumbnail, build_count, last_modified, last_modified_by, created, create_by, last_unpacked, last_unpacked_by, last_wrapped, last_wrapped_by, last_unwrapped, last_unwrapped_by, size, has_snapshot, needs_rewrap, built_with, tested_with, fixed_bugs, requires_root, requires_restart, ac_handling, dependencies, resolved, filter, screenshots].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 20
return nil unless attributes.is_a?(Hash)
- 20
self.class.swagger_types.each_pair do |key, type|
- 660
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
- 60
if attributes[self.class.attribute_map[key]].is_a?(Array)
- 205
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 600
elsif !attributes[self.class.attribute_map[key]].nil?
- 455
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 20
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 600
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
- 260
value.to_s
when :Integer
- 100
value.to_i
when :Float
value.to_f
when :BOOLEAN
- 100
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- 30
true
else
- 70
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- 140
temp_model = CrxPackageManager.const_get(type).new
- 140
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class PackageList
- 1
attr_accessor :results
- 1
attr_accessor :total
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 20
{
:'results' => :'results',
:'total' => :'total'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 5
{
:'results' => :'Array<Package>',
:'total' => :'Integer'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 7
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 7
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 7
if attributes.has_key?(:'results')
if (value = attributes[:'results']).is_a?(Array)
self.results = value
end
end
- 7
if attributes.has_key?(:'total')
self.total = attributes[:'total']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
results == o.results &&
total == o.total
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[results, total].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 5
return nil unless attributes.is_a?(Hash)
- 5
self.class.swagger_types.each_pair do |key, type|
- 10
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
- 5
if attributes[self.class.attribute_map[key]].is_a?(Array)
- 25
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 5
elsif !attributes[self.class.attribute_map[key]].nil?
- 5
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 5
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 25
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
- 5
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- 20
temp_model = CrxPackageManager.const_get(type).new
- 20
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class ServiceExecResponse
- 1
attr_accessor :success
- 1
attr_accessor :msg
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
{
:'success' => :'success',
:'msg' => :'msg'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
{
:'success' => :'BOOLEAN',
:'msg' => :'String'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 3
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 3
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 3
if attributes.has_key?(:'success')
self.success = attributes[:'success']
end
- 3
if attributes.has_key?(:'msg')
self.msg = attributes[:'msg']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
success == o.success &&
msg == o.msg
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[success, msg].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class ServiceResponse
- 1
attr_accessor :version
- 1
attr_accessor :user
- 1
attr_accessor :workspace
- 1
attr_accessor :request
- 1
attr_accessor :response
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 110
{
:'version' => :'version',
:'user' => :'user',
:'workspace' => :'workspace',
:'request' => :'request',
:'response' => :'response'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 11
{
:'version' => :'String',
:'user' => :'String',
:'workspace' => :'String',
:'request' => :'ServiceResponseRequest',
:'response' => :'ServiceResponseResponse'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 17
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 17
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 17
if attributes.has_key?(:'version')
self.version = attributes[:'version']
end
- 17
if attributes.has_key?(:'user')
self.user = attributes[:'user']
end
- 17
if attributes.has_key?(:'workspace')
self.workspace = attributes[:'workspace']
end
- 17
if attributes.has_key?(:'request')
self.request = attributes[:'request']
end
- 17
if attributes.has_key?(:'response')
self.response = attributes[:'response']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
version == o.version &&
user == o.user &&
workspace == o.workspace &&
request == o.request &&
response == o.response
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[version, user, workspace, request, response].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 11
return nil unless attributes.is_a?(Hash)
- 11
self.class.swagger_types.each_pair do |key, type|
- 55
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 55
elsif !attributes[self.class.attribute_map[key]].nil?
- 55
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 11
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 55
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
- 33
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- 22
temp_model = CrxPackageManager.const_get(type).new
- 22
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class ServiceResponseRequest
- 1
attr_accessor :param
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 20
{
:'param' => :'param'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 11
{
:'param' => :'Array<ServiceResponseRequestParam>'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 13
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 13
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 13
if attributes.has_key?(:'param')
if (value = attributes[:'param']).is_a?(Array)
self.param = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
param == o.param
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[param].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 11
return nil unless attributes.is_a?(Hash)
- 11
self.class.swagger_types.each_pair do |key, type|
- 11
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
- 11
if attributes[self.class.attribute_map[key]].is_a?(Array)
- 26
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 11
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 17
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- 17
temp_model = CrxPackageManager.const_get(type).new
- 17
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class ServiceResponseRequestParam
- 1
attr_accessor :name
- 1
attr_accessor :value
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 68
{
:'name' => :'name',
:'value' => :'value'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 17
{
:'name' => :'String',
:'value' => :'String'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 20
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 20
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 20
if attributes.has_key?(:'name')
self.name = attributes[:'name']
end
- 20
if attributes.has_key?(:'value')
self.value = attributes[:'value']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
name == o.name &&
value == o.value
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[name, value].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 17
return nil unless attributes.is_a?(Hash)
- 17
self.class.swagger_types.each_pair do |key, type|
- 34
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 34
elsif !attributes[self.class.attribute_map[key]].nil?
- 34
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 17
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 34
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
- 34
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class ServiceResponseResponse
- 1
attr_accessor :data
- 1
attr_accessor :status
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
- 44
{
:'data' => :'data',
:'status' => :'status'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
- 11
{
:'data' => :'Object',
:'status' => :'Object'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 14
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 14
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 14
if attributes.has_key?(:'data')
self.data = attributes[:'data']
end
- 14
if attributes.has_key?(:'status')
self.status = attributes[:'status']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
data == o.data &&
status == o.status
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[data, status].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
- 11
return nil unless attributes.is_a?(Hash)
- 11
self.class.swagger_types.each_pair do |key, type|
- 22
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
- 22
elsif !attributes[self.class.attribute_map[key]].nil?
- 22
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
- 11
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
- 22
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
- 22
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
=begin
CRX Package Manager API
API for interacting with the CRX Package Manager in AEM.
OpenAPI spec version: 6.2.0
Contact: bryan.stopp@gmail.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
- 1
require 'date'
- 1
module CrxPackageManager
- 1
class UpdateStatus
- 1
attr_accessor :success
- 1
attr_accessor :msg
- 1
attr_accessor :path
# Attribute mapping from ruby-style variable name to JSON key.
- 1
def self.attribute_map
{
:'success' => :'success',
:'msg' => :'msg',
:'path' => :'path'
}
end
# Attribute type mapping.
- 1
def self.swagger_types
{
:'success' => :'BOOLEAN',
:'msg' => :'String',
:'path' => :'String'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
- 1
def initialize(attributes = {})
- 4
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
- 4
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
- 4
if attributes.has_key?(:'success')
self.success = attributes[:'success']
end
- 4
if attributes.has_key?(:'msg')
self.msg = attributes[:'msg']
end
- 4
if attributes.has_key?(:'path')
self.path = attributes[:'path']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
- 1
def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
- 1
def valid?
true
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
- 1
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
success == o.success &&
msg == o.msg &&
path == o.path
end
# @see the `==` method
# @param [Object] Object to be compared
- 1
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
- 1
def hash
[success, msg, path].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
- 1
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
- 1
def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = CrxPackageManager.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
- 1
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
- 1
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
- 1
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
- 1
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end