scalr 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.rdoc → README.markdown} +16 -16
- data/lib/scalr/request.rb +2 -2
- data/lib/scalr/version.rb +3 -0
- metadata +23 -59
- data/.document +0 -5
- data/.gitignore +0 -24
- data/LICENSE +0 -20
- data/Rakefile +0 -54
- data/VERSION +0 -1
- data/scalr.gemspec +0 -64
- data/test/helper.rb +0 -10
- data/test/test_scalr.rb +0 -7
@@ -1,41 +1,41 @@
|
|
1
|
-
|
1
|
+
# Scalr Gem
|
2
2
|
|
3
3
|
Scalr is a cloud infrastructure management provider. This gem is for interfacing with the Scalr.net API to obtain information about your instances and farms.
|
4
4
|
|
5
5
|
As of version 0.2.0 the Scalr gem has been updated to use the Scalr 2.0 API (thanks to threetee).
|
6
6
|
|
7
|
-
|
7
|
+
## Installing Scalr
|
8
8
|
|
9
|
-
|
9
|
+
$ gem install scalr
|
10
10
|
|
11
|
-
|
11
|
+
## Usage
|
12
12
|
|
13
13
|
First, include rubygems and scalr:
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
require 'rubygems'
|
16
|
+
require 'scalr'
|
17
17
|
|
18
18
|
Now, just initialize scalr with your api values (can be found in your system settings on scalr.net):
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
Scalr.key_id = "your_key_id"
|
21
|
+
Scalr.access_key = "your_access_key"
|
22
22
|
|
23
23
|
Like most rubyist, I can't stand camel case, so you make calls to the scalr API with their underscore equivalent names and parameters:
|
24
24
|
|
25
|
-
|
25
|
+
response = Scalr.list_dns_zone_records(:domain_name => 'domain.com')
|
26
26
|
|
27
27
|
All API calls return a Scalr::Response instance with the following attributes:
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
response.code # the HTTP response code from the API request
|
30
|
+
response.message # the HTTP response message
|
31
|
+
response.value # the value returned from the API as a hash
|
32
|
+
response.error # if the requests returns an API error it is stored here for easy access
|
33
33
|
|
34
34
|
Just like the actions and inputs, all returned values are put in the response.value hash as underscored symbols (converted from the camel case returned by the gateway).
|
35
35
|
|
36
36
|
I recommend opening up an irb session and making test calls to figure out the response structures.
|
37
37
|
|
38
|
-
|
38
|
+
## Note on Patches/Pull Requests
|
39
39
|
|
40
40
|
* Fork the project.
|
41
41
|
* Make your feature addition or bug fix.
|
@@ -45,6 +45,6 @@ I recommend opening up an irb session and making test calls to figure out the re
|
|
45
45
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
46
46
|
* Send me a pull request. Bonus points for topic branches.
|
47
47
|
|
48
|
-
|
48
|
+
## Copyright
|
49
49
|
|
50
|
-
Copyright (c) 2010
|
50
|
+
Copyright (c) 2010 RedBeard Tech. See LICENSE for details.
|
data/lib/scalr/request.rb
CHANGED
@@ -86,7 +86,7 @@ module Scalr
|
|
86
86
|
set_signature!
|
87
87
|
http = Net::HTTP.new(@endpoint, 443)
|
88
88
|
http.use_ssl = true
|
89
|
-
response, data = http.get("/?" + query_string + "&Signature=#{
|
89
|
+
response, data = http.get("/?" + query_string + "&Signature=#{@signature}", nil)
|
90
90
|
return Scalr::Response.new(response, data)
|
91
91
|
end
|
92
92
|
|
@@ -113,7 +113,7 @@ module Scalr
|
|
113
113
|
string_to_sign = query_string.gsub('=','').gsub('&','')
|
114
114
|
hmac = HMAC::SHA256.new(@access_key)
|
115
115
|
hmac.update(string_to_sign)
|
116
|
-
@signature = Base64.encode64(hmac.digest).chomp
|
116
|
+
@signature = URI.escape(Base64.encode64(hmac.digest).chomp, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
117
117
|
end
|
118
118
|
|
119
119
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scalr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Hodgson
|
@@ -15,27 +15,13 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-22 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: thoughtbot-shoulda
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
type: :development
|
34
|
-
version_requirements: *id001
|
35
21
|
- !ruby/object:Gem::Dependency
|
36
22
|
name: activesupport
|
37
23
|
prerelease: false
|
38
|
-
requirement: &
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
26
|
requirements:
|
41
27
|
- - ">="
|
@@ -45,54 +31,31 @@ dependencies:
|
|
45
31
|
- 0
|
46
32
|
version: "0"
|
47
33
|
type: :runtime
|
48
|
-
version_requirements: *
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: ruby-hmac
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
hash: 15
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
- 4
|
61
|
-
- 0
|
62
|
-
version: 0.4.0
|
63
|
-
type: :runtime
|
64
|
-
version_requirements: *id003
|
34
|
+
version_requirements: *id001
|
65
35
|
description: Scalr is a cloud infrastructure management provider. This gem is for interfacing with the Scalr.net API to obtain information about your instances and farms.
|
66
|
-
email:
|
36
|
+
email:
|
37
|
+
- mhodgson@redbeard-tech.com
|
67
38
|
executables: []
|
68
39
|
|
69
40
|
extensions: []
|
70
41
|
|
71
|
-
extra_rdoc_files:
|
72
|
-
|
73
|
-
- README.rdoc
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
74
44
|
files:
|
75
|
-
- .document
|
76
|
-
- .gitignore
|
77
|
-
- LICENSE
|
78
|
-
- README.rdoc
|
79
|
-
- Rakefile
|
80
|
-
- VERSION
|
81
|
-
- lib/scalr.rb
|
82
45
|
- lib/scalr/core_extensions/hash.rb
|
83
46
|
- lib/scalr/core_extensions/http.rb
|
84
47
|
- lib/scalr/request.rb
|
85
48
|
- lib/scalr/response.rb
|
86
|
-
- scalr.
|
87
|
-
-
|
88
|
-
-
|
49
|
+
- lib/scalr/version.rb
|
50
|
+
- lib/scalr.rb
|
51
|
+
- README.markdown
|
89
52
|
has_rdoc: true
|
90
|
-
homepage: http://github.com/
|
53
|
+
homepage: http://github.com/redbeard-tech/mongoid-sphinx
|
91
54
|
licenses: []
|
92
55
|
|
93
56
|
post_install_message:
|
94
|
-
rdoc_options:
|
95
|
-
|
57
|
+
rdoc_options: []
|
58
|
+
|
96
59
|
require_paths:
|
97
60
|
- lib
|
98
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -109,10 +72,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
72
|
requirements:
|
110
73
|
- - ">="
|
111
74
|
- !ruby/object:Gem::Version
|
112
|
-
hash:
|
75
|
+
hash: 21
|
113
76
|
segments:
|
114
|
-
-
|
115
|
-
|
77
|
+
- 1
|
78
|
+
- 3
|
79
|
+
- 7
|
80
|
+
version: 1.3.7
|
116
81
|
requirements: []
|
117
82
|
|
118
83
|
rubyforge_project:
|
@@ -120,6 +85,5 @@ rubygems_version: 1.3.7
|
|
120
85
|
signing_key:
|
121
86
|
specification_version: 3
|
122
87
|
summary: A Scalr API wrapper gem
|
123
|
-
test_files:
|
124
|
-
|
125
|
-
- test/test_scalr.rb
|
88
|
+
test_files: []
|
89
|
+
|
data/.document
DELETED
data/.gitignore
DELETED
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 Matt Hodgson
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "scalr"
|
8
|
-
gem.summary = %Q{A Scalr API wrapper gem}
|
9
|
-
gem.description = %Q{Scalr is a cloud infrastructure management provider. This gem is for interfacing with the Scalr.net API to obtain information about your instances and farms.}
|
10
|
-
gem.email = "mhodgson@youcastr.com"
|
11
|
-
gem.homepage = "http://github.com/mhodgson/scalr"
|
12
|
-
gem.authors = ["Matt Hodgson"]
|
13
|
-
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
-
gem.add_dependency "activesupport", ">= 0"
|
15
|
-
gem.add_dependency "ruby-hmac", ">= 0.4.0"
|
16
|
-
end
|
17
|
-
Jeweler::GemcutterTasks.new
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'rake/testtask'
|
23
|
-
Rake::TestTask.new(:test) do |test|
|
24
|
-
test.libs << 'lib' << 'test'
|
25
|
-
test.pattern = 'test/**/test_*.rb'
|
26
|
-
test.verbose = true
|
27
|
-
end
|
28
|
-
|
29
|
-
begin
|
30
|
-
require 'rcov/rcovtask'
|
31
|
-
Rcov::RcovTask.new do |test|
|
32
|
-
test.libs << 'test'
|
33
|
-
test.pattern = 'test/**/test_*.rb'
|
34
|
-
test.verbose = true
|
35
|
-
end
|
36
|
-
rescue LoadError
|
37
|
-
task :rcov do
|
38
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
task :test => :check_dependencies
|
43
|
-
|
44
|
-
task :default => :test
|
45
|
-
|
46
|
-
require 'rake/rdoctask'
|
47
|
-
Rake::RDocTask.new do |rdoc|
|
48
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
-
|
50
|
-
rdoc.rdoc_dir = 'rdoc'
|
51
|
-
rdoc.title = "scalr #{version}"
|
52
|
-
rdoc.rdoc_files.include('README*')
|
53
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.1
|
data/scalr.gemspec
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{scalr}
|
8
|
-
s.version = "0.2.1"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Matt Hodgson"]
|
12
|
-
s.date = %q{2010-10-17}
|
13
|
-
s.description = %q{Scalr is a cloud infrastructure management provider. This gem is for interfacing with the Scalr.net API to obtain information about your instances and farms.}
|
14
|
-
s.email = %q{mhodgson@youcastr.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"lib/scalr.rb",
|
27
|
-
"lib/scalr/core_extensions/hash.rb",
|
28
|
-
"lib/scalr/core_extensions/http.rb",
|
29
|
-
"lib/scalr/request.rb",
|
30
|
-
"lib/scalr/response.rb",
|
31
|
-
"scalr.gemspec",
|
32
|
-
"test/helper.rb",
|
33
|
-
"test/test_scalr.rb"
|
34
|
-
]
|
35
|
-
s.homepage = %q{http://github.com/mhodgson/scalr}
|
36
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.7}
|
39
|
-
s.summary = %q{A Scalr API wrapper gem}
|
40
|
-
s.test_files = [
|
41
|
-
"test/helper.rb",
|
42
|
-
"test/test_scalr.rb"
|
43
|
-
]
|
44
|
-
|
45
|
-
if s.respond_to? :specification_version then
|
46
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
-
s.specification_version = 3
|
48
|
-
|
49
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
51
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
52
|
-
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0.4.0"])
|
53
|
-
else
|
54
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
55
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
56
|
-
s.add_dependency(%q<ruby-hmac>, [">= 0.4.0"])
|
57
|
-
end
|
58
|
-
else
|
59
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
60
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
61
|
-
s.add_dependency(%q<ruby-hmac>, [">= 0.4.0"])
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
data/test/helper.rb
DELETED