Class: DroneApi::Auth

Inherits:
Base
  • Object
show all
Defined in:
lib/drone_api/auth.rb

Defined Under Namespace

Classes: Params

Instance Attribute Summary collapse

Attributes inherited from Base

#account_id, #client_id, #client_secret, #response_data, #response_status

Instance Method Summary collapse

Methods inherited from Base

#api_path, #env_url, #errors, #is_form_request?, #make_request, #parse_payload, #process_request, #query_params, #request, #request_type, #requires_authentication?, #response, #set_auth_header, #valid?

Constructor Details

#initialize(params = {}) ⇒ Auth

Returns a new instance of Auth.



16
17
18
19
# File 'lib/drone_api/auth.rb', line 16

def initialize params={}
  super()
  @params = Params.new(params)
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



9
10
11
# File 'lib/drone_api/auth.rb', line 9

def token
  @token
end

Instance Method Details

#executeObject



21
22
23
24
25
26
27
# File 'lib/drone_api/auth.rb', line 21

def execute
  validate
  if valid?
    create_token
    DroneApi.configuration.current_token = @token
  end
end