class OSDNClient::DefaultApi
Attributes
Public Class Methods
# File lib/osdn-client/api/default_api.rb, line 30 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
return pong for test @param [Hash] opts the optional parameters @return [Pong]
# File lib/osdn-client/api/default_api.rb, line 38 def ping(opts = {}) data, _status_code, _headers = ping_with_http_info(opts) return data end
return pong for test @param [Hash] opts the optional parameters @return [Array<(Pong
, Fixnum, Hash)>] Pong
data, response status code and response headers
# File lib/osdn-client/api/default_api.rb, line 47 def ping_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DefaultApi.ping ..." end # resource path local_var_path = "/ping".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = [] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['application/x-www-form-urlencoded'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2-code', 'oauth2-implicit'] 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 => 'Pong') if @api_client.config.debugging @api_client.config.logger.debug "API called: DefaultApi#ping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get access token by access code. @param client_id Your application ID @param client_secret Your application secret (key) @param [Hash] opts the optional parameters @option opts [String] :grant_type "authorization_code" or "refresh_token" (default to authorization_code) @option opts [String] :code Set auth code issued by osdn.net/account/oauth2ui/authorize for grant_type=authorization_code @option opts [String] :refresh_token Set refresh token to update access token. @return [Token]
# File lib/osdn-client/api/default_api.rb, line 96 def token(client_id, client_secret, opts = {}) data, _status_code, _headers = token_with_http_info(client_id, client_secret, opts) return data end
Get access token by access code. @param client_id Your application ID @param client_secret Your application secret (key) @param [Hash] opts the optional parameters @option opts [String] :grant_type "authorization_code" or "refresh_token" @option opts [String] :code Set auth code issued by osdn.net/account/oauth2ui/authorize for grant_type=authorization_code @option opts [String] :refresh_token Set refresh token to update access token. @return [Array<(Token
, Fixnum, Hash)>] Token
data, response status code and response headers
# File lib/osdn-client/api/default_api.rb, line 110 def token_with_http_info(client_id, client_secret, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DefaultApi.token ..." end # verify the required parameter 'client_id' is set fail ArgumentError, "Missing the required parameter 'client_id' when calling DefaultApi.token" if client_id.nil? # verify the required parameter 'client_secret' is set fail ArgumentError, "Missing the required parameter 'client_secret' when calling DefaultApi.token" if client_secret.nil? # resource path local_var_path = "/token".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = [] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['application/x-www-form-urlencoded'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} form_params["client_id"] = client_id form_params["client_secret"] = client_secret form_params["grant_type"] = opts[:'grant_type'] if !opts[:'grant_type'].nil? form_params["code"] = opts[:'code'] if !opts[:'code'].nil? form_params["refresh_token"] = opts[:'refresh_token'] if !opts[:'refresh_token'].nil? # http body (model) post_body = nil auth_names = [] 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 => 'Token') if @api_client.config.debugging @api_client.config.logger.debug "API called: DefaultApi#token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end