class HaveAPI::GoClient::Authentication::Token

Attributes

http_header[R]

HTTP header the token is sent in @return [String]

query_parameter[R]

Query parameter the token is sent in @return [String]

resource[R]

Resource for token manipulation @return [Resource]

Public Class Methods

new(api_version, name, desc) click to toggle source
# File lib/haveapi/go_client/authentication/token.rb, line 19
def initialize(api_version, name, desc)
  @http_header = desc[:http_header]
  @query_parameter = desc[:query_parameter]
  @resource = Resource.new(
    api_version,
    :token,
    desc[:resources][:token],
    prefix: 'auth_token',
  )
  resource.resolve_associations
end

Public Instance Methods

custom_actions() click to toggle source

@return [Array<Action>]

# File lib/haveapi/go_client/authentication/token.rb, line 50
def custom_actions
  @custom_actions ||= resource.actions.reject do |a|
    %w(request renew revoke).include?(a.name)
  end
end
generate(gen) click to toggle source
# File lib/haveapi/go_client/authentication/token.rb, line 31
def generate(gen)
  ErbTemplate.render_to_if_changed(
    'authentication/token.go',
    {
      package: gen.package,
      auth: self,
    },
    File.join(gen.dst, 'auth_token.go')
  )

  resource.generate(gen)
end
request_action() click to toggle source

@return [Action]

# File lib/haveapi/go_client/authentication/token.rb, line 45
def request_action
  @request_action ||= resource.actions.detect { |a| a.name == 'request' }
end