rightscale-api 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ begin
7
7
  gemspec.email = "david.michael@sonymusic.com"
8
8
  gemspec.homepage = "http://github.com/dmichael/rightscale-api"
9
9
  gemspec.authors = ["David Michael"]
10
+ gemspec.add_development_dependency "httparty"
10
11
  end
11
12
  Jeweler::GemcutterTasks.new
12
13
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.4.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rightscale-api}
8
- s.version = "0.2.0"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Michael"]
12
- s.date = %q{2010-01-28}
12
+ s.date = %q{2010-03-11}
13
13
  s.description = %q{A Ruby Wrapper for the RightScale API}
14
14
  s.email = %q{david.michael@sonymusic.com}
15
15
  s.extra_rdoc_files = [
@@ -19,13 +19,6 @@ Gem::Specification.new do |s|
19
19
  "README.markdown",
20
20
  "Rakefile",
21
21
  "VERSION",
22
- "lib/rightscale.rb",
23
- "lib/rightscale/api.rb",
24
- "lib/rightscale/client.rb",
25
- "lib/rightscale/deployments.rb",
26
- "lib/rightscale/right_scripts.rb",
27
- "lib/rightscale/servers.rb",
28
- "lib/rightscale/statuses.rb",
29
22
  "pkg/rightscale-api-0.0.1.gem",
30
23
  "rightscale-api.gemspec"
31
24
  ]
@@ -40,9 +33,12 @@ Gem::Specification.new do |s|
40
33
  s.specification_version = 3
41
34
 
42
35
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
36
+ s.add_development_dependency(%q<httparty>, [">= 0"])
43
37
  else
38
+ s.add_dependency(%q<httparty>, [">= 0"])
44
39
  end
45
40
  else
41
+ s.add_dependency(%q<httparty>, [">= 0"])
46
42
  end
47
43
  end
48
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rightscale-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Michael
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-28 00:00:00 -05:00
12
+ date: 2010-03-11 00:00:00 -05:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
16
25
  description: A Ruby Wrapper for the RightScale API
17
26
  email: david.michael@sonymusic.com
18
27
  executables: []
@@ -25,13 +34,6 @@ files:
25
34
  - README.markdown
26
35
  - Rakefile
27
36
  - VERSION
28
- - lib/rightscale.rb
29
- - lib/rightscale/api.rb
30
- - lib/rightscale/client.rb
31
- - lib/rightscale/deployments.rb
32
- - lib/rightscale/right_scripts.rb
33
- - lib/rightscale/servers.rb
34
- - lib/rightscale/statuses.rb
35
37
  - pkg/rightscale-api-0.0.1.gem
36
38
  - rightscale-api.gemspec
37
39
  has_rdoc: true
@@ -1,49 +0,0 @@
1
- module RightScale
2
- class API
3
- attr_reader :client
4
-
5
- def initialize(client, options = {})
6
- @client = client
7
- @resource = options[:resource] || self.class.name.split('::').last.downcase
8
- @singular = @resource.chop
9
- @format = 'xml'
10
- end
11
-
12
- def index
13
- response = client.get("/#{@resource}.#{@format}")
14
- return response["#{@resource}"]
15
- end
16
-
17
- def show(identifier)
18
- # puts formatted_uri(identifier)
19
- response = client.get formatted_uri(identifier)
20
-
21
- return response["#{@singular}"] || response
22
- end
23
-
24
- def create
25
- # implement in derivative classes
26
- end
27
-
28
- def update
29
- # implement in derivative classes
30
- end
31
-
32
- def destroy(identifier)
33
- response = client.delete("/#{@resource}/#{identifier}")
34
- end
35
-
36
- # As discussed in more detail in the RightScale API Overview Guide, every
37
- # major resource exported by the RightScale API will always have an href
38
- # field that corresponds to the URL of the resource listed.
39
-
40
- def formatted_uri(identifier)
41
- if identifier.is_a?(String)
42
- identifier.gsub(client.class.base_uri, '')
43
- else
44
- "/#{@resource}/#{identifier}.#{@format}"
45
- end
46
- end
47
-
48
- end
49
- end
@@ -1,45 +0,0 @@
1
- module RightScale
2
- class Client
3
- include HTTParty
4
-
5
- def initialize(account, email, password)
6
- @account, @email, @password = account, email, password
7
- self.class.base_uri "https://my.rightscale.com/api/acct/#{@account}"
8
- end
9
-
10
- def get(path, options={})
11
- request :get, path, options
12
- end
13
-
14
- def post(path, options={})
15
- request :post, path, options
16
- end
17
-
18
- def request(method, path, options={})
19
- options.merge!({
20
- :basic_auth => {:username => @email, :password => @password},
21
- :headers => {'X-API-VERSION' => '1.0'}
22
- })
23
-
24
- response = self.class.send(method, "#{path}", options)
25
- # puts response.inspect
26
- return response
27
- end
28
-
29
- def deployments
30
- @deployments ||= Deployments.new(self)
31
- end
32
-
33
- def servers
34
- @servers ||= Servers.new(self)
35
- end
36
-
37
- def statuses
38
- @statuses ||= Statuses.new(self)
39
- end
40
-
41
- def right_scripts
42
- @right_scripts ||= RightScripts.new(self, :resource => 'right_scripts')
43
- end
44
- end
45
- end
@@ -1,5 +0,0 @@
1
- module RightScale
2
- # http://support.rightscale.com/15-References/RightScale_API_Reference_Guide/02-Management/01-Deployments
3
- class Deployments < API
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module RightScale
2
- # http://support.rightscale.com/15-References/RightScale_API_Reference_Guide/02-Management/01-Deployments
3
- class RightScripts < API
4
- end
5
- end
@@ -1,38 +0,0 @@
1
- module RightScale
2
- # http://support.rightscale.com/15-References/RightScale_API_Reference_Guide/02-Management/02-Servers
3
- class Servers < API
4
- def start(identifier)
5
- response = client.post("/servers/#{identifier}/start")
6
- end
7
-
8
- def stop(identifier)
9
- response = client.post("/servers/#{identifier}/stop")
10
- end
11
-
12
- def reboot(identifier)
13
- response = client.post("/servers/#{identifier}/reboot")
14
- end
15
-
16
- def run_script(identifier, right_script_href, params = {})
17
- query = {:server => {:right_script_href => right_script_href}}
18
- query[:server].merge(params) if !params.empty?
19
-
20
- response = client.post("/servers/#{identifier}/run_script", :query => query)
21
- return response
22
- end
23
-
24
- def attach_volume(ec2_ebs_volume_href, device)
25
- response = client.post("/servers/#{identifier}/attach_volume", :query => {
26
- :server => {
27
- :ec2_ebs_volume_href => ec2_ebs_volume_href,
28
- :device => device
29
- }
30
- })
31
- end
32
-
33
- def settings(identifier)
34
- response = client.get("#{formatted_uri(identifier)}/settings")
35
- return response['settings']
36
- end
37
- end
38
- end
@@ -1,16 +0,0 @@
1
- module RightScale
2
- class Statuses < API
3
- # attr_reader :client
4
- #
5
- # def initialize(client)
6
- # @client = client
7
- # @@resource = self.class.name.split('::').last.downcase
8
- # @@format = 'xml'
9
- # end
10
- #
11
- # def show(identifier)
12
- # response = client.get("/#{@@resource}/#{identifier}.#{@@format}")
13
- # return response["#{@@resource.chop}"]
14
- # end
15
- end
16
- end
data/lib/rightscale.rb DELETED
@@ -1,17 +0,0 @@
1
- require 'pathname'
2
- require 'rubygems'
3
- require 'httparty'
4
- require 'pp'
5
- require 'socket'
6
-
7
- dir = Pathname(__FILE__).dirname.expand_path
8
-
9
- require dir + 'rightscale/api'
10
- require dir + 'rightscale/client'
11
-
12
- # Management API
13
- require dir + 'rightscale/deployments'
14
- require dir + 'rightscale/servers'
15
- require dir + 'rightscale/right_scripts'
16
- require dir + 'rightscale/statuses'
17
-