RightScaleAPIHelper 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +1 -1
- data/RightScaleAPIHelper.gemspec +1 -3
- data/VERSION +1 -1
- data/lib/RightScaleAPIHelper.rb +11 -4
- metadata +10 -12
- data/README.markdown +0 -26
data/LICENSE.txt
CHANGED
data/RightScaleAPIHelper.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "RightScaleAPIHelper"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Eric VanWieren"]
|
@@ -14,14 +14,12 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = "eric@codex.org"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
|
-
"README.markdown",
|
18
17
|
"README.rdoc"
|
19
18
|
]
|
20
19
|
s.files = [
|
21
20
|
"Gemfile",
|
22
21
|
"Gemfile.lock",
|
23
22
|
"LICENSE.txt",
|
24
|
-
"README.markdown",
|
25
23
|
"README.rdoc",
|
26
24
|
"Rakefile",
|
27
25
|
"RightScaleAPIHelper.gemspec",
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/lib/RightScaleAPIHelper.rb
CHANGED
@@ -11,8 +11,12 @@ module RightScaleAPIHelper
|
|
11
11
|
require 'net/http'
|
12
12
|
require 'net/https'
|
13
13
|
|
14
|
-
# Initialize the connection
|
15
|
-
|
14
|
+
# Initialize the connection with account information.
|
15
|
+
# Return an object that can then later be used to make calls
|
16
|
+
# against the RightScale API without authenticating again.
|
17
|
+
# Inputs: format = xml or js
|
18
|
+
# version = 1.0 # 1.5 to be supported soon
|
19
|
+
def initialize(account, username, password, format = 'js', version = '1.0')
|
16
20
|
# Set Default Variables
|
17
21
|
rs_url = "https://my.rightscale.com"
|
18
22
|
api_url = '/api/acct/'
|
@@ -22,8 +26,11 @@ module RightScaleAPIHelper
|
|
22
26
|
@conn = Net::HTTP.new('my.rightscale.com', 443)
|
23
27
|
@conn.use_ssl=true
|
24
28
|
#@conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
29
|
+
if version != '1.0'
|
30
|
+
raise("Only version 1.0 is supported")
|
31
|
+
end
|
25
32
|
|
26
|
-
req = Net::HTTP::Get.new("#{@full_api_call}/login?api_version
|
33
|
+
req = Net::HTTP::Get.new("#{@full_api_call}/login?api_version=#{version}")
|
27
34
|
req.basic_auth( username, password )
|
28
35
|
resp = @conn.request(req)
|
29
36
|
if resp.code.to_i != 204
|
@@ -70,4 +77,4 @@ module RightScaleAPIHelper
|
|
70
77
|
resp = @conn.request(req)
|
71
78
|
end
|
72
79
|
end
|
73
|
-
end
|
80
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RightScaleAPIHelper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &70308117092400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70308117092400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &70308117091560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70308117091560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70308117090620 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70308117090620
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70308117089720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 1.8.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70308117089720
|
58
58
|
description: Simple wrapper for connecting and using the RightScale API. Eases the
|
59
59
|
use of connecting with a username and password, and then provides an object to do
|
60
60
|
GET, PUT, POST, DELETE requests. Returns an HTTP response.
|
@@ -63,13 +63,11 @@ executables: []
|
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files:
|
65
65
|
- LICENSE.txt
|
66
|
-
- README.markdown
|
67
66
|
- README.rdoc
|
68
67
|
files:
|
69
68
|
- Gemfile
|
70
69
|
- Gemfile.lock
|
71
70
|
- LICENSE.txt
|
72
|
-
- README.markdown
|
73
71
|
- README.rdoc
|
74
72
|
- Rakefile
|
75
73
|
- RightScaleAPIHelper.gemspec
|
@@ -92,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
90
|
version: '0'
|
93
91
|
segments:
|
94
92
|
- 0
|
95
|
-
hash:
|
93
|
+
hash: 2613822372223237183
|
96
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
95
|
none: false
|
98
96
|
requirements:
|
data/README.markdown
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
RightScaleAPIHelper
|
2
|
-
=========================
|
3
|
-
|
4
|
-
This GEM is a simple wrapper for the RightScale API. It simplifies authentication, and provides an object to run GET, PUT, POST, and DELETE calls.
|
5
|
-
|
6
|
-
Usage
|
7
|
-
-----
|
8
|
-
Create new instance
|
9
|
-
|
10
|
-
RightScaleAPIHelper::Helper.new(acct_id, email, password, format=('js'/'xml'), version = 1.0)
|
11
|
-
|
12
|
-
Example
|
13
|
-
|
14
|
-
api_conn = RightScaleAPIHelper::Helper.new(123456, 'email@email.com', 'password')
|
15
|
-
|
16
|
-
resp = api_conn.get("/deployments")
|
17
|
-
puts resp.code # Response code from RightScale
|
18
|
-
puts resp.body # xml or json response
|
19
|
-
|
20
|
-
|
21
|
-
Copyright
|
22
|
-
---------
|
23
|
-
|
24
|
-
Copyright (c) 2012 Eric VanWieren. See LICENSE.txt for
|
25
|
-
further details.
|
26
|
-
|