colombo 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -30,6 +30,10 @@ end
30
30
  ### Droplets
31
31
 
32
32
  ```ruby
33
+
34
+ # This method returns a specfic droplet (via droplet id) without having to fetch all droplets first
35
+ @client.droplet( droplet_id )
36
+
33
37
  # This method returns all active droplets that are currently running in your account
34
38
  @client.droplets()
35
39
 
@@ -71,6 +75,9 @@ new_droplet = droplets.create({
71
75
  # snapshots or backups that you have created in your own account.
72
76
  @client.images
73
77
 
78
+ # Takes the optional parameter filter, either :my_images or :global
79
+ @client.images(:filter => :my_images)
80
+
74
81
  # This method displays the attributes of an image.
75
82
  @client.images.find(image_id)
76
83
 
@@ -16,6 +16,10 @@ module Colombo
16
16
 
17
17
  end
18
18
 
19
+ def droplet(droplet_id)
20
+ Droplet.find(self, droplet_id)
21
+ end
22
+
19
23
  def droplets
20
24
  Droplets.new(self)
21
25
  end
@@ -24,8 +28,8 @@ module Colombo
24
28
  Regions.new(self)
25
29
  end
26
30
 
27
- def images
28
- Images.new(self)
31
+ def images(options={})
32
+ Images.new(self, options)
29
33
  end
30
34
 
31
35
  def sizes
@@ -6,6 +6,12 @@ module Colombo
6
6
  attr_accessor :id, :name, :image_id, :size_id, :region_id
7
7
  attr_accessor :backups_active, :ip_address, :status
8
8
 
9
+ def self.find(client, droplet_id)
10
+ client.request(:get, "/droplets/#{droplet_id}") do |response|
11
+ return self.new(client, response['droplet'])
12
+ end
13
+ end
14
+
9
15
  def reboot
10
16
  @client.request(:get, "/droplets/#{self.id}/reboot/") do |response|
11
17
  return response['event_id']
@@ -20,7 +20,7 @@ module Colombo
20
20
  raise "Required `#{key}` attribute" if not options.include?( key )
21
21
  end
22
22
 
23
- if not options[:ssh_keys].nil?
23
+ if options[:ssh_keys]
24
24
  options[:ssh_keys] = options[:ssh_keys].join(',')
25
25
  end
26
26
 
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  module Colombo
3
4
  class Image < Resource
4
5
 
@@ -5,9 +5,9 @@ require "colombo/image"
5
5
  module Colombo
6
6
  class Images < Container
7
7
 
8
- def initialize(client)
8
+ def initialize(client, options)
9
9
  @client = client
10
- @client.request(:get, '/images/', {}) do |response|
10
+ @client.request(:get, '/images/', options) do |response|
11
11
  response['images'].each do |image|
12
12
  self << Image.new(@client, image)
13
13
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  module Colombo
3
4
  class Region < Resource
4
5
 
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  module Colombo
3
4
  class Size < Resource
4
5
 
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  module Colombo
3
4
  class SshKey < Resource
4
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Colombo
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
@@ -21,7 +21,6 @@ describe 'Images' do
21
21
  end
22
22
  end
23
23
 
24
-
25
24
  it 'find image via find method' do
26
25
  VCR.use_cassette('images') do
27
26
  @client.images.find(COLOMBO_IMAGE_ID).wont_be_nil
@@ -34,4 +33,16 @@ describe 'Images' do
34
33
  end
35
34
  end
36
35
 
36
+ it 'images filtered by my_images' do
37
+ VCR.use_cassette('images-filter-my_images') do
38
+ @client.images(:filter => :my_images).wont_be_empty
39
+ end
40
+ end
41
+
42
+ it 'images filtered by global' do
43
+ VCR.use_cassette('images-filter-global') do
44
+ @client.images(:filter => :global).wont_be_empty
45
+ end
46
+ end
47
+
37
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colombo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,11 +36,11 @@ cert_chain:
36
36
  TGVnalVadkdRSEdmSHN0bDdkd2lCVWluZ1UvMldOTFIKMXBIQThXeGsxVVJi
37
37
  Nmxxa2NRdERZbDkyU3FTSk1FY0s0Wk0zRmwrRFM0RXBtM1BINTZlWjR3Qlha
38
38
  REhMRUNuTwpubjhCMXUyKwotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2013-07-30 00:00:00.000000000 Z
39
+ date: 2013-09-04 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json
43
- requirement: &70314675746380 !ruby/object:Gem::Requirement
43
+ requirement: &70331982662780 !ruby/object:Gem::Requirement
44
44
  none: false
45
45
  requirements:
46
46
  - - ~>
@@ -48,10 +48,10 @@ dependencies:
48
48
  version: 1.8.0
49
49
  type: :runtime
50
50
  prerelease: false
51
- version_requirements: *70314675746380
51
+ version_requirements: *70331982662780
52
52
  - !ruby/object:Gem::Dependency
53
53
  name: rest-client
54
- requirement: &70314675777760 !ruby/object:Gem::Requirement
54
+ requirement: &70331982662260 !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements:
57
57
  - - ~>
@@ -59,10 +59,10 @@ dependencies:
59
59
  version: 1.6.7
60
60
  type: :runtime
61
61
  prerelease: false
62
- version_requirements: *70314675777760
62
+ version_requirements: *70331982662260
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: minitest
65
- requirement: &70314675776940 !ruby/object:Gem::Requirement
65
+ requirement: &70331982661780 !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
68
  - - ~>
@@ -70,10 +70,10 @@ dependencies:
70
70
  version: 5.0.6
71
71
  type: :development
72
72
  prerelease: false
73
- version_requirements: *70314675776940
73
+ version_requirements: *70331982661780
74
74
  - !ruby/object:Gem::Dependency
75
75
  name: webmock
76
- requirement: &70314675775580 !ruby/object:Gem::Requirement
76
+ requirement: &70331982661140 !ruby/object:Gem::Requirement
77
77
  none: false
78
78
  requirements:
79
79
  - - =
@@ -81,10 +81,10 @@ dependencies:
81
81
  version: 1.8.0
82
82
  type: :development
83
83
  prerelease: false
84
- version_requirements: *70314675775580
84
+ version_requirements: *70331982661140
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: vcr
87
- requirement: &70314675774200 !ruby/object:Gem::Requirement
87
+ requirement: &70331982660420 !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
90
90
  - - =
@@ -92,10 +92,10 @@ dependencies:
92
92
  version: 2.5.0
93
93
  type: :development
94
94
  prerelease: false
95
- version_requirements: *70314675774200
95
+ version_requirements: *70331982660420
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: turn
98
- requirement: &70314675772880 !ruby/object:Gem::Requirement
98
+ requirement: &70331982659600 !ruby/object:Gem::Requirement
99
99
  none: false
100
100
  requirements:
101
101
  - - ! '>='
@@ -103,10 +103,10 @@ dependencies:
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
- version_requirements: *70314675772880
106
+ version_requirements: *70331982659600
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: rake
109
- requirement: &70314675771400 !ruby/object:Gem::Requirement
109
+ requirement: &70331982674760 !ruby/object:Gem::Requirement
110
110
  none: false
111
111
  requirements:
112
112
  - - ! '>='
@@ -114,7 +114,7 @@ dependencies:
114
114
  version: '0'
115
115
  type: :development
116
116
  prerelease: false
117
- version_requirements: *70314675771400
117
+ version_requirements: *70331982674760
118
118
  description: A simple ruby client for Digital Ocean API
119
119
  email:
120
120
  - lmmendes@gmail.com
metadata.gz.sig CHANGED
Binary file