Class: Terminal::Client

Inherits:
Object
  • Object
show all
Includes:
API
Defined in:
lib/terminal/client.rb

Constant Summary collapse

API_VERSION =
"v0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Modules::UsageAndCredits

#balance, #burn_estimates, #burn_history, #burn_state

Methods included from Modules::RequestProgress

#request_progress

Methods included from Modules::CreateAndManageSnapshots

#count_snapshots, #delete_snapshot, #edit_snapshot, #list_snapshots, #snapshot_terminal

Methods included from Modules::CreateAndManageTerminals

#delete_terminal, #edit_terminal, #edit_terminal_access, #get_terminal, #list_terminal_access, #list_terminals, #pause_terminal, #restart_terminal, #resume_terminal, #start_snapshot

Methods included from Modules::BrowseSnapshotsAndUsers

#count_public_snapshots, #get_profile, #get_snapshot, #list_public_snapshots

Constructor Details

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

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/terminal/client.rb', line 10

def initialize(options = {})
  options.each do | k, v |
    if v.is_a?(Integer)
      raise Terminal::APIConfigurationError
    end
    send(:"#{k}=", v)
  end
  yield(self) if block_given?

  @api_prefix = options[:api_url] + "/" + API_VERSION + "/"
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



8
9
10
# File 'lib/terminal/client.rb', line 8

def access_token
  @access_token
end

#api_prefixObject

Returns the value of attribute api_prefix.



8
9
10
# File 'lib/terminal/client.rb', line 8

def api_prefix
  @api_prefix
end

#api_urlObject

Returns the value of attribute api_url.



8
9
10
# File 'lib/terminal/client.rb', line 8

def api_url
  @api_url
end

#user_tokenObject

Returns the value of attribute user_token.



8
9
10
# File 'lib/terminal/client.rb', line 8

def user_token
  @user_token
end

Instance Method Details

#post(path, params = {}) ⇒ Object



22
23
24
# File 'lib/terminal/client.rb', line 22

def post(path, params = {} )
  request(:post, path, params)
end