Class: SphereEngine::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/sphere_engine/client.rb

Direct Known Subclasses

REST::Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ SphereEngine::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
15
16
# File 'lib/sphere_engine/client.rb', line 11

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Instance Attribute Details

#access_token_compilersObject

Returns the value of attribute access_token_compilers.



5
6
7
# File 'lib/sphere_engine/client.rb', line 5

def access_token_compilers
  @access_token_compilers
end

#access_token_problemsObject

Returns the value of attribute access_token_problems.



5
6
7
# File 'lib/sphere_engine/client.rb', line 5

def access_token_problems
  @access_token_problems
end

Instance Method Details

#credentialsHash

Returns:

  • (Hash)


19
20
21
22
23
24
# File 'lib/sphere_engine/client.rb', line 19

def credentials
  {
    access_token_compilers: access_token_compilers,
    access_token_problems: access_token_problems
  }
end

#credentials?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/sphere_engine/client.rb', line 27

def credentials?
  credentials.values.all?
end

#get_token(service) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/sphere_engine/client.rb', line 32

def get_token(service)
  return case service
  when :compilers
    access_token_compilers
  when :problems
    access_token_problems
  end
end