Module: Oceanarium

Defined in:
lib/oceanarium.rb,
lib/oceanarium/config.rb,
lib/oceanarium/request.rb,
lib/oceanarium/version.rb,
lib/oceanarium/resources.rb,
lib/oceanarium/resources/size.rb,
lib/oceanarium/resources/image.rb,
lib/oceanarium/resources/domain.rb,
lib/oceanarium/resources/record.rb,
lib/oceanarium/resources/region.rb,
lib/oceanarium/resources/sshkey.rb,
lib/oceanarium/resources/droplet.rb

Defined Under Namespace

Modules: Config, Resources Classes: Domain, Droplet, Image, Record, Region, Request, SSHKey, Size

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.domain(id = nil) ⇒ Object

/domains/



75
76
77
# File 'lib/oceanarium.rb', line 75

def self.domain(id = nil)
  Oceanarium::Domain.new(id, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
end

.domainsObject



79
80
81
82
83
84
85
86
87
88
# File 'lib/oceanarium.rb', line 79

def self.domains
  unless Oceanarium::Config.api_key.nil? || Oceanarium::Config.client_id.nil?
    @domains = Array.new()
    Oceanarium::Domain.all.each do |domain|
      @object = Oceanarium::Domain.new(domain, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
      @domains << @object
    end
    @domains
  end
end

.droplet(id = nil) ⇒ Object

User API roots: /droplets/



12
13
14
# File 'lib/oceanarium.rb', line 12

def self.droplet(id = nil)
  Oceanarium::Droplet.new(id, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
end

.dropletsObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/oceanarium.rb', line 16

def self.droplets
  unless Oceanarium::Config.api_key.nil? || Oceanarium::Config.client_id.nil?
    @droplets = Array.new()
    Oceanarium::Droplet.all.each do |droplet|
      @object = Oceanarium::Droplet.new(droplet, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
      @droplets << @object
    end
    @droplets
  end
end

.image(id = nil) ⇒ Object

/images/



29
30
31
# File 'lib/oceanarium.rb', line 29

def self.image(id = nil)
  Oceanarium::Image.new(id, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
end

.images(scope = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/oceanarium.rb', line 33

def self.images(scope = nil)
  unless Oceanarium::Config.api_key.nil? || Oceanarium::Config.client_id.nil?
    @images = Array.new()
    if scope.nil?
      Oceanarium::Image.all.each do |image|
        @object = Oceanarium::Image.new(image, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
        @images << @object
      end
    elsif scope == 'global'
      Oceanarium::Image.global.each do |image|
        @object = Oceanarium::Image.new(image, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
        @images << @object
      end
    elsif scope == 'my_images'
      Oceanarium::Image.local.each do |image|
        @object = Oceanarium::Image.new(image, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
        @images << @object
      end
    end
  end
  @images
end

.regionsObject

/regions/



105
106
107
108
109
110
111
112
113
114
# File 'lib/oceanarium.rb', line 105

def self.regions
  unless Oceanarium::Config.api_key.nil? || Oceanarium::Config.client_id.nil?
    @regions = Array.new
    Oceanarium::Region.all.each do |region|
      @object = Oceanarium::Region.new(region, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
      @regions << @object
    end
    @regions
  end
end

.sizesObject

/sizes/



92
93
94
95
96
97
98
99
100
101
# File 'lib/oceanarium.rb', line 92

def self.sizes
  unless Oceanarium::Config.api_key.nil? || Oceanarium::Config.client_id.nil?
    @sizes = Array.new()
    Oceanarium::Size.all.each do |size|
      @object = Oceanarium::Size.new(size, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
      @sizes << @object
    end
    @sizes
  end
end

.ssh_key(id = nil) ⇒ Object

/ssh_keys/



58
59
60
# File 'lib/oceanarium.rb', line 58

def self.ssh_key(id = nil)
  Oceanarium::SSHKey.new(id, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
end

.ssh_keysObject



62
63
64
65
66
67
68
69
70
71
# File 'lib/oceanarium.rb', line 62

def self.ssh_keys
  unless Oceanarium::Config.api_key.nil? || Oceanarium::Config.client_id.nil?
    @keys = Array.new()
    Oceanarium::SSHKey.all.each do |key|
      @object = Oceanarium::SSHKey.new(key, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
      @keys << @object
    end
    @keys
  end
end