Class: Smartdc::Client

Inherits:
Object
  • Object
show all
Includes:
CassetteRack::Request, Api::Analytics, Api::Analytics::Heatmap, Api::Datacenters, Api::Images, Api::Keys, Api::Machines, Api::Machines::Metadata, Api::Machines::Snapshots, Api::Machines::Tags, Api::Packages
Defined in:
lib/smartdc/client.rb

Instance Method Summary collapse

Methods included from Api::Analytics::Heatmap

#analytic_details, #analytic_image

Methods included from Api::Analytics

#analytic, #analytics, #create_analytic, #describe_analytics, #destroy_analytic, #value_analytic

Methods included from Api::Machines::Snapshots

#create_machine_snapshot, #destroy_machine_snapshot, #machine_snapshot, #machine_snapshots, #start_machine_snapshot

Methods included from Api::Machines::Metadata

#destroy_machine_metadata, #machine_metadata, #update_machine_metadata

Methods included from Api::Machines::Tags

#create_machine_tag, #destroy_machine_tag, #machine_tag, #machine_tags

Methods included from Api::Machines

#create_machine, #destroy_machine, #machine, #machines, #reboot_machine, #resize_machine, #start_machine, #stop_machine

Methods included from Api::Keys

#create_key, #destroy_key, #key, #keys

Methods included from Api::Packages

#package, #packages

Methods included from Api::Images

#image, #images

Methods included from Api::Datacenters

#datacenter, #datacenters

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/smartdc/client.rb', line 28

def initialize(options={})
  options = Smartdc.config.options.merge(options)
  auth = Smartdc::Auth.new(options)
  date = Time.now.gmtime.to_s

  @request_options = {
    builder: options[:middleware],
    url: options[:url],
    ssl: { verify: options[:ssl_verify] },
    headers: {
      date: date, authorization: auth.signature(date),
      'content-type' => 'application/json', accept: 'application/json',
      'x-api-version' => options[:version]
    }
  }
end