Class: CloudsmithApi::BadgesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudsmith-api/api/badges_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BadgesApi

Returns a new instance of BadgesApi.



19
20
21
# File 'lib/cloudsmith-api/api/badges_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cloudsmith-api/api/badges_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#badges_version_list(owner, repo, package_format, package_name, package_version, package_identifiers, opts = {}) ⇒ PackageVersionBadge

Get latest package version for a package or package group. Get latest package version for a package or package group.

Parameters:

  • owner
  • repo
  • package_format
  • package_name
  • package_version
  • package_identifiers
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :badge_token (String)

    Badge token to authenticate for private packages (default to )

  • :cache_seconds (String)

    Override the shields.io badge cacheSeconds value. (default to 300)

  • :color (String)

    Override the shields.io badge color value. (default to 12577E)

  • :label (String)

    Override the shields.io badge label value. (default to cloudsmith)

  • :label_color (String)

    Override the shields.io badge labelColor value. (default to 021F2F)

  • :logo_color (String)

    Override the shields.io badge logoColor value. (default to 45B6EE)

  • :logo_width (String)

    Override the shields.io badge logoWidth value. (default to 10)

  • :render (BOOLEAN)

    If true, badge will be rendered (default to false)

  • :shields (BOOLEAN)

    If true, a shields response will be generated (default to false)

  • :show_latest (BOOLEAN)

    If true, for latest version badges a '(latest)' suffix is added (default to false)

  • :style (String)

    Override the shields.io badge style value. (default to flat-square)

Returns:



43
44
45
46
# File 'lib/cloudsmith-api/api/badges_api.rb', line 43

def badges_version_list(owner, repo, package_format, package_name, package_version, package_identifiers, opts = {})
  data, _status_code, _headers = badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, opts)
  data
end

#badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, opts = {}) ⇒ Array<(PackageVersionBadge, Fixnum, Hash)>

Get latest package version for a package or package group. Get latest package version for a package or package group.

Parameters:

  • owner
  • repo
  • package_format
  • package_name
  • package_version
  • package_identifiers
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :badge_token (String)

    Badge token to authenticate for private packages

  • :cache_seconds (String)

    Override the shields.io badge cacheSeconds value.

  • :color (String)

    Override the shields.io badge color value.

  • :label (String)

    Override the shields.io badge label value.

  • :label_color (String)

    Override the shields.io badge labelColor value.

  • :logo_color (String)

    Override the shields.io badge logoColor value.

  • :logo_width (String)

    Override the shields.io badge logoWidth value.

  • :render (BOOLEAN)

    If true, badge will be rendered

  • :shields (BOOLEAN)

    If true, a shields response will be generated

  • :show_latest (BOOLEAN)

    If true, for latest version badges a &#39;(latest)&#39; suffix is added

  • :style (String)

    Override the shields.io badge style value.

Returns:

  • (Array<(PackageVersionBadge, Fixnum, Hash)>)

    PackageVersionBadge data, response status code and response headers



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/cloudsmith-api/api/badges_api.rb', line 69

def badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BadgesApi.badges_version_list ...'
  end
  # verify the required parameter 'owner' is set
  if @api_client.config.client_side_validation && owner.nil?
    fail ArgumentError, "Missing the required parameter 'owner' when calling BadgesApi.badges_version_list"
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling BadgesApi.badges_version_list"
  end
  # verify the required parameter 'package_format' is set
  if @api_client.config.client_side_validation && package_format.nil?
    fail ArgumentError, "Missing the required parameter 'package_format' when calling BadgesApi.badges_version_list"
  end
  # verify the required parameter 'package_name' is set
  if @api_client.config.client_side_validation && package_name.nil?
    fail ArgumentError, "Missing the required parameter 'package_name' when calling BadgesApi.badges_version_list"
  end
  # verify the required parameter 'package_version' is set
  if @api_client.config.client_side_validation && package_version.nil?
    fail ArgumentError, "Missing the required parameter 'package_version' when calling BadgesApi.badges_version_list"
  end
  # verify the required parameter 'package_identifiers' is set
  if @api_client.config.client_side_validation && package_identifiers.nil?
    fail ArgumentError, "Missing the required parameter 'package_identifiers' when calling BadgesApi.badges_version_list"
  end
  # resource path
  local_var_path = '/badges/version/{owner}/{repo}/{package_format}/{package_name}/{package_version}/{package_identifiers}/'.sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'package_format' + '}', package_format.to_s).sub('{' + 'package_name' + '}', package_name.to_s).sub('{' + 'package_version' + '}', package_version.to_s).sub('{' + 'package_identifiers' + '}', package_identifiers.to_s)

  # query parameters
  query_params = {}
  query_params[:'badge_token'] = opts[:'badge_token'] if !opts[:'badge_token'].nil?
  query_params[:'cacheSeconds'] = opts[:'cache_seconds'] if !opts[:'cache_seconds'].nil?
  query_params[:'color'] = opts[:'color'] if !opts[:'color'].nil?
  query_params[:'label'] = opts[:'label'] if !opts[:'label'].nil?
  query_params[:'labelColor'] = opts[:'label_color'] if !opts[:'label_color'].nil?
  query_params[:'logoColor'] = opts[:'logo_color'] if !opts[:'logo_color'].nil?
  query_params[:'logoWidth'] = opts[:'logo_width'] if !opts[:'logo_width'].nil?
  query_params[:'render'] = opts[:'render'] if !opts[:'render'].nil?
  query_params[:'shields'] = opts[:'shields'] if !opts[:'shields'].nil?
  query_params[:'show_latest'] = opts[:'show_latest'] if !opts[:'show_latest'].nil?
  query_params[:'style'] = opts[:'style'] if !opts[:'style'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['apikey', 'basic', 'token']
  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 => 'PackageVersionBadge')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BadgesApi#badges_version_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end