Class: Tutum

Inherits:
Object
  • Object
show all
Defined in:
lib/tutum.rb,
lib/version.rb

Constant Summary collapse

VERSION =
"0.2.7"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Tutum

Returns a new instance of Tutum.



16
17
18
19
20
21
# File 'lib/tutum.rb', line 16

def initialize(*options)
  @options = extract_options! options
  @username = @options[:username]
  @api_key = @options[:api_key]
  @tutum_auth = @options[:tutum_auth]
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



14
15
16
# File 'lib/tutum.rb', line 14

def api_key
  @api_key
end

#tutum_authObject (readonly)

Returns the value of attribute tutum_auth.



14
15
16
# File 'lib/tutum.rb', line 14

def tutum_auth
  @tutum_auth
end

#usernameObject (readonly)

Returns the value of attribute username.



14
15
16
# File 'lib/tutum.rb', line 14

def username
  @username
end

Instance Method Details

#actionsObject



31
32
33
# File 'lib/tutum.rb', line 31

def actions
  @actions ||= TutumActions.new(headers)
end

#containersObject



35
36
37
# File 'lib/tutum.rb', line 35

def containers
  @containers ||= TutumContainers.new(headers)
end

#headersObject



23
24
25
26
27
28
29
# File 'lib/tutum.rb', line 23

def headers
  {
    'Authorization' => @tutum_auth ? @tutum_auth : "ApiKey #{@username}:#{@api_key}",
    'Accept' => 'application/json',
    'Content-Type' => 'application/json'
  }
end

#imagesObject



39
40
41
# File 'lib/tutum.rb', line 39

def images
  @images ||= TutumImages.new(headers)
end

#node_clustersObject



43
44
45
# File 'lib/tutum.rb', line 43

def node_clusters
  @node_clusters ||= TutumNodeClusters.new(headers)
end

#node_typesObject



47
48
49
# File 'lib/tutum.rb', line 47

def node_types
  @node_types ||= TutumNodeTypes.new(headers)
end

#nodesObject



51
52
53
# File 'lib/tutum.rb', line 51

def nodes
  @nodes ||= TutumNodes.new(headers)
end

#providersObject



55
56
57
# File 'lib/tutum.rb', line 55

def providers
  @providers ||= TutumProviders.new(headers)
end

#regionsObject



59
60
61
# File 'lib/tutum.rb', line 59

def regions
  @regions ||= TutumRegions.new(headers)
end

#servicesObject



63
64
65
# File 'lib/tutum.rb', line 63

def services
  @services ||= TutumServices.new(headers)
end

#stacksObject



67
68
69
# File 'lib/tutum.rb', line 67

def stacks
  @stacks ||= TutumStacks.new(headers)
end