Class: Vscale::Api::Client

Inherits:
Object
  • Object
show all
Includes:
Vscale::Account, Background, Backups, Billing, Configurations, Domains, Notifications, Request, SSHKeys, Servers
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 SSHKeys

#sshkeys, #sshkeys_delete, #sshkeys_new

Methods included from Servers

#add_scalet_tag, #delete_scalet, #find_scalet, #new_scalet, #remove_scalet_tag, #restart_scalet, #scalet_sshkeys, #scalet_tag, #scalets, #scalets_tags, #start_scalet, #stop_scalet, #task, #update_scalet_tag, #upgrade_scalet

Methods included from Request

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

Methods included from Notifications

#notify, #update_notify

Methods included from Domains

#add_domain, #add_domain_record, #add_domains_ptr, #add_domains_tags, #domain_id, #domain_record, #domain_records, #domains, #domains_ptr, #domains_ptr_id, #domains_tag_id, #domains_tags, #remove_domain, #remove_domain_record, #remove_domains_tag, #remove_ptr_id, #update_domain, #update_domain_record, #update_domains_tag, #update_ptr_id

Methods included from Configurations

#prices, #rplans

Methods included from Billing

#consumption, #payments

Methods included from Backups

#backup, #backups, #create_backup, #create_from_backup, #delete_backup

Methods included from Background

#images, #locations

Methods included from Vscale::Account

#account

Constructor Details

#initialize(token) ⇒ Client

Returns a new instance of Client.



36
37
38
39
40
41
42
43
44
45
# File 'lib/vscale/api.rb', line 36

def initialize(token)
  @token = token

  uri = URI.parse(API_ENDPOINT)

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