Class: Vscale::Api::Client

Inherits:
Object
  • Object
show all
Includes:
Vscale::Account, Background, Billing, Configurations, Request, SSHKeys, Servers, Tickets, Tokens
Defined in:
lib/vscale/api.rb

Constant Summary

Constants included from Request

Request::API_ENDPOINT, Request::VERB_MAP

Instance Method Summary collapse

Methods included from Tokens

#find_token, #remove_token, #tokens, #update_token

Methods included from Tickets

#ticket_comments, #tickets, #tickets_add_comment, #tickets_close, #tickets_new

Methods included from SSHKeys

#sshkeys, #sshkeys_delete, #sshkeys_new

Methods included from Servers

#delete_scalet, #find_scalet, #new_scalet, #restart_scalet, #scalet_sshkeys, #scalets, #start_scalet, #stop_scalet, #task, #upgrade_scalet

Methods included from Request

#delete, #get, #patch, #post, #put

Methods included from Configurations

#prices, #rplans

Methods included from Billing

#consumption, #payments

Methods included from Background

#images, #locations

Methods included from Vscale::Account

#account, #auth

Constructor Details

#initialize(token, api_endpoint = API_ENDPOINT) ⇒ Client

Returns a new instance of Client.



30
31
32
33
34
35
36
37
38
39
# File 'lib/vscale/api.rb', line 30

def initialize(token, api_endpoint = API_ENDPOINT)
  @token = token
  @api_endpoint = api_endpoint

  uri = URI.parse(@api_endpoint)

  @http = Net::HTTP.start(uri.host, uri.port, use_ssl: true)
  @http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  @http.ssl_version = :TLSv1_2
end