Class: SwaggerClient::UserTokenApi

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_client/api/user_token_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UserTokenApi

Returns a new instance of UserTokenApi.



19
20
21
# File 'lib/swagger_client/api/user_token_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/swagger_client/api/user_token_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#user_token_issue(request, site_id, version, opts = {}) ⇒ IssueResponse

Get a staff user token.

Parameters:

  • request
  • site_id

    ID of the site from which to pull data.

  • version
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/swagger_client/api/user_token_api.rb', line 28

def user_token_issue(request, site_id, version, opts = {})
  data, _status_code, _headers = user_token_issue_with_http_info(request, site_id, version, opts)
  data
end

#user_token_issue_with_http_info(request, site_id, version, opts = {}) ⇒ Array<(IssueResponse, Fixnum, Hash)>

Get a staff user token.

Parameters:

  • request
  • site_id

    ID of the site from which to pull data.

  • version
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    IssueResponse data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/swagger_client/api/user_token_api.rb', line 39

def user_token_issue_with_http_info(request, site_id, version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserTokenApi.user_token_issue ...'
  end
  # verify the required parameter 'request' is set
  if @api_client.config.client_side_validation && request.nil?
    fail ArgumentError, "Missing the required parameter 'request' when calling UserTokenApi.user_token_issue"
  end
  # verify the required parameter 'site_id' is set
  if @api_client.config.client_side_validation && site_id.nil?
    fail ArgumentError, "Missing the required parameter 'site_id' when calling UserTokenApi.user_token_issue"
  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 UserTokenApi.user_token_issue"
  end
  # resource path
  local_var_path = '/public/v{version}/usertoken/issue'.sub('{' + 'version' + '}', version.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml', 'multipart/form-data'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded', 'multipart/form-data'])
  header_params[:'siteId'] = site_id

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request)
  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 => 'IssueResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserTokenApi#user_token_issue\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#user_token_revoke(site_id, version, opts = {}) ⇒ Object

Revoke a user token. Revokes the user token in the Authorization header.

Parameters:

  • site_id

    ID of the site from which to pull data.

  • version
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :authorization (String)

    A staff user authorization token. (default to )

Returns:

  • (Object)


94
95
96
97
# File 'lib/swagger_client/api/user_token_api.rb', line 94

def user_token_revoke(site_id, version, opts = {})
  data, _status_code, _headers = user_token_revoke_with_http_info(site_id, version, opts)
  data
end

#user_token_revoke_with_http_info(site_id, version, opts = {}) ⇒ Array<(Object, Fixnum, Hash)>

Revoke a user token. Revokes the user token in the Authorization header.

Parameters:

  • site_id

    ID of the site from which to pull data.

  • version
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :authorization (String)

    A staff user authorization token.

Returns:

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

    Object data, response status code and response headers



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
139
140
141
142
143
144
145
146
147
148
# File 'lib/swagger_client/api/user_token_api.rb', line 106

def user_token_revoke_with_http_info(site_id, version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserTokenApi.user_token_revoke ...'
  end
  # verify the required parameter 'site_id' is set
  if @api_client.config.client_side_validation && site_id.nil?
    fail ArgumentError, "Missing the required parameter 'site_id' when calling UserTokenApi.user_token_revoke"
  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 UserTokenApi.user_token_revoke"
  end
  # resource path
  local_var_path = '/public/v{version}/usertoken/revoke'.sub('{' + 'version' + '}', version.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml', 'multipart/form-data'])
  header_params[:'siteId'] = site_id
  header_params[:'authorization'] = opts[:'authorization'] if !opts[:'authorization'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Object')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserTokenApi#user_token_revoke\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end