Class: NagaApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/naga/naga_api_client.rb

Constant Summary collapse

@@BASE_URL =

@@BASE_URL = “localhost:3000/api/v1/”

"https://naga-unit-testing.herokuapp.com/api/v1/"
@@FILE_PATH =
File.join(Dir.home, ".minitest_naga")

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNagaApiClient

Returns a new instance of NagaApiClient.



10
11
12
13
14
15
16
17
18
19
# File 'lib/minitest/naga/naga_api_client.rb', line 10

def initialize
  @options = { headers: { "Content-Type" => "application/x-www-form-urlencoded" } }
  @authenticated = false
  if File.file?(@@FILE_PATH)
    @credentials = eval(File.read(@@FILE_PATH))
    validate(@credentials)
  else
    authenticate
  end
end

Instance Attribute Details

#authentication_tokenObject (readonly)

Returns the value of attribute authentication_token.



8
9
10
# File 'lib/minitest/naga/naga_api_client.rb', line 8

def authentication_token
  @authentication_token
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



6
7
8
# File 'lib/minitest/naga/naga_api_client.rb', line 6

def credentials
  @credentials
end

#emailObject (readonly)

Returns the value of attribute email.



7
8
9
# File 'lib/minitest/naga/naga_api_client.rb', line 7

def email
  @email
end

Class Method Details

.BASE_URLObject



21
22
23
# File 'lib/minitest/naga/naga_api_client.rb', line 21

def self.BASE_URL
  @@BASE_URL
end

.FILE_PATHObject



25
26
27
# File 'lib/minitest/naga/naga_api_client.rb', line 25

def self.FILE_PATH
  @@FILE_PATH
end

Instance Method Details

#authenticated?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/minitest/naga/naga_api_client.rb', line 33

def authenticated?
  @authenticated
end