linode 0.7.9 → 0.7.10
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/CHANGELOG +5 -0
- data/README.md +1 -0
- data/VERSION +1 -1
- data/lib/linode.rb +1 -1
- data/linode.gemspec +8 -8
- data/spec/linode_spec.rb +18 -6
- data/spec/spec_helper.rb +2 -0
- metadata +16 -14
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -136,6 +136,7 @@ irb> ^D@ Wed Aug 05 01:50:52 rick@Yer-Moms-Computer
|
|
136
136
|
## CREDITS:
|
137
137
|
|
138
138
|
* Thanks to Kenn Ejima ([kenn](http://github.com/kenn)) for json library improvements, OStruct cleanups, README improvements, etc.
|
139
|
+
* Thanks to Arthur D'Antonio III ([arthurD](http://github.com/arthurD)) for a patch to fix string decoding via HTTParty.parsed_response.
|
139
140
|
* Thanks to Aditya Sanghi ([asanghi](http://github.com/asanghi)) for a patch to properly namespace stackscripts functionality.
|
140
141
|
* Thanks to Dan Hodos ([danhodos](http://github.com/danhodos)) for diagnosing and fixing an issue with sending GET requests instead of POST request.
|
141
142
|
* Thanks to Aaron Hamid for updates for RSpec 2 and work on user.getapikey + username/password initialization.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.10
|
data/lib/linode.rb
CHANGED
data/linode.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.7.
|
7
|
+
s.name = %q{linode}
|
8
|
+
s.version = "0.7.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rick Bradley"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = %q{2012-10-19}
|
13
|
+
s.description = %q{This is a wrapper around Linode's automation facilities.}
|
14
|
+
s.email = %q{rick@rickbradley.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.md"
|
17
17
|
]
|
@@ -57,10 +57,10 @@ Gem::Specification.new do |s|
|
|
57
57
|
"spec/linode_spec.rb",
|
58
58
|
"spec/spec_helper.rb"
|
59
59
|
]
|
60
|
-
s.homepage =
|
60
|
+
s.homepage = %q{http://github.com/rick/linode}
|
61
61
|
s.require_paths = ["lib"]
|
62
|
-
s.rubygems_version =
|
63
|
-
s.summary =
|
62
|
+
s.rubygems_version = %q{1.6.2}
|
63
|
+
s.summary = %q{a Ruby wrapper for the Linode API}
|
64
64
|
|
65
65
|
if s.respond_to? :specification_version then
|
66
66
|
s.specification_version = 3
|
data/spec/linode_spec.rb
CHANGED
@@ -70,6 +70,8 @@ describe 'Linode' do
|
|
70
70
|
|
71
71
|
it 'should use the user.getapikey remote call to look up the API key associated with the username/password combo specified at creation time' do
|
72
72
|
@json = '{"ERRORARRAY":[],"DATA":{"USERNAME":"ogc","API_KEY":"blahblahblah"},"ACTION":"user.getapikey"}'
|
73
|
+
@json.stubs(:parsed_response).returns(JSON.parse(@json))
|
74
|
+
|
73
75
|
HTTParty.expects(:post).with(@api_url,
|
74
76
|
:body => {
|
75
77
|
:api_action => 'user.getapikey',
|
@@ -136,6 +138,7 @@ describe 'Linode' do
|
|
136
138
|
"ACTION":"test.echo",
|
137
139
|
"DATA":{"FOO":"bar"}
|
138
140
|
}!
|
141
|
+
@json.stubs(:parsed_response).returns(JSON.parse(@json))
|
139
142
|
HTTParty.stubs(:post).returns(@json)
|
140
143
|
@linode.stubs(:api_url).returns('https://fake.linode.com/')
|
141
144
|
end
|
@@ -216,21 +219,27 @@ describe 'Linode' do
|
|
216
219
|
|
217
220
|
describe 'when the result is a list of hashes' do
|
218
221
|
it 'should return a list of objects with lower-cased methods for the data fields' do
|
219
|
-
|
222
|
+
@json = %Q!{
|
220
223
|
"ERRORARRAY":[],
|
221
224
|
"ACTION":"test.echo",
|
222
225
|
"DATA":[{"FOO":"bar"},{"BAR":"baz"}]
|
223
|
-
}!
|
226
|
+
}!
|
227
|
+
@json.stubs(:parsed_response).returns(JSON.parse(@json))
|
228
|
+
|
229
|
+
HTTParty.stubs(:post).returns(@json)
|
224
230
|
@linode.send_request('test.echo', {}).first.foo.should == 'bar'
|
225
231
|
@linode.send_request('test.echo', {}).last.bar.should == 'baz'
|
226
232
|
end
|
227
233
|
|
228
234
|
it 'should return a list of objects which do not respond to upper-case URLs for the data fields' do
|
229
|
-
|
235
|
+
@json = %Q!{
|
230
236
|
"ERRORARRAY":[],
|
231
237
|
"ACTION":"test.echo",
|
232
238
|
"DATA":[{"FOO":"bar"},{"BAR":"baz"}]
|
233
|
-
}!
|
239
|
+
}!
|
240
|
+
@json.stubs(:parsed_response).returns(JSON.parse(@json))
|
241
|
+
|
242
|
+
HTTParty.stubs(:post).returns(@json)
|
234
243
|
@linode.send_request('test.echo', {}).first.should_not respond_to(:FOO)
|
235
244
|
@linode.send_request('test.echo', {}).last.should_not respond_to(:BAR)
|
236
245
|
end
|
@@ -248,17 +257,20 @@ describe 'Linode' do
|
|
248
257
|
|
249
258
|
describe 'when the result is neither a list nor a hash' do
|
250
259
|
it 'should return the result unchanged' do
|
251
|
-
|
260
|
+
@json = %Q!{
|
252
261
|
"ERRORARRAY":[],
|
253
262
|
"ACTION":"test.echo",
|
254
263
|
"DATA":"thingie"
|
255
|
-
}!
|
264
|
+
}!
|
265
|
+
@json.stubs(:parsed_response).returns(JSON.parse(@json))
|
266
|
+
HTTParty.stubs(:post).returns(@json)
|
256
267
|
@linode.send_request('test.echo', {}).should == "thingie"
|
257
268
|
end
|
258
269
|
end
|
259
270
|
|
260
271
|
it 'should be able to parse real JSON when processing a request' do
|
261
272
|
json = '{"ERRORARRAY":[],"DATA":[{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":90,"IS64BIT":0,"LABEL":"Arch Linux 2011.08","MINIMAGESIZE":500,"CREATE_DT":"2011-09-26 17:18:05.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":91,"IS64BIT":1,"LABEL":"Arch Linux 2011.08 64bit","MINIMAGESIZE":500,"CREATE_DT":"2011-09-26 17:18:05.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":88,"IS64BIT":0,"LABEL":"CentOS 6.2","MINIMAGESIZE":800,"CREATE_DT":"2011-07-19 11:38:20.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":89,"IS64BIT":1,"LABEL":"CentOS 6.2 64bit","MINIMAGESIZE":800,"CREATE_DT":"2011-07-19 11:38:20.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":77,"IS64BIT":0,"LABEL":"Debian 6","MINIMAGESIZE":550,"CREATE_DT":"2011-02-08 16:54:31.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":78,"IS64BIT":1,"LABEL":"Debian 6 64bit","MINIMAGESIZE":550,"CREATE_DT":"2011-02-08 16:54:31.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":94,"IS64BIT":0,"LABEL":"Fedora 16","MINIMAGESIZE":1000,"CREATE_DT":"2012-04-09 14:12:04.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":95,"IS64BIT":1,"LABEL":"Fedora 16 64bit","MINIMAGESIZE":1000,"CREATE_DT":"2012-04-09 14:12:32.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":72,"IS64BIT":0,"LABEL":"Gentoo","MINIMAGESIZE":1000,"CREATE_DT":"2010-09-13 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":53,"IS64BIT":1,"LABEL":"Gentoo 64bit","MINIMAGESIZE":1000,"CREATE_DT":"2009-04-04 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":96,"IS64BIT":0,"LABEL":"openSUSE 12.1","MINIMAGESIZE":1000,"CREATE_DT":"2012-04-13 11:43:30.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":97,"IS64BIT":1,"LABEL":"openSUSE 12.1 64bit","MINIMAGESIZE":1000,"CREATE_DT":"2012-04-13 11:43:30.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":86,"IS64BIT":0,"LABEL":"Slackware 13.37","MINIMAGESIZE":600,"CREATE_DT":"2011-06-05 15:11:59.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":87,"IS64BIT":1,"LABEL":"Slackware 13.37 64bit","MINIMAGESIZE":600,"CREATE_DT":"2011-06-05 15:11:59.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":64,"IS64BIT":0,"LABEL":"Ubuntu 10.04 LTS","MINIMAGESIZE":450,"CREATE_DT":"2010-04-29 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":65,"IS64BIT":1,"LABEL":"Ubuntu 10.04 LTS 64bit","MINIMAGESIZE":450,"CREATE_DT":"2010-04-29 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":92,"IS64BIT":0,"LABEL":"Ubuntu 11.10","MINIMAGESIZE":750,"CREATE_DT":"2011-10-14 14:29:42.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":93,"IS64BIT":1,"LABEL":"Ubuntu 11.10 64bit","MINIMAGESIZE":850,"CREATE_DT":"2011-10-14 14:29:42.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":59,"IS64BIT":0,"LABEL":"CentOS 5.6","MINIMAGESIZE":950,"CREATE_DT":"2009-08-17 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":60,"IS64BIT":1,"LABEL":"CentOS 5.6 64bit","MINIMAGESIZE":950,"CREATE_DT":"2009-08-17 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":50,"IS64BIT":0,"LABEL":"Debian 5.0","MINIMAGESIZE":350,"CREATE_DT":"2009-02-19 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":51,"IS64BIT":1,"LABEL":"Debian 5.0 64bit","MINIMAGESIZE":350,"CREATE_DT":"2009-02-19 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":84,"IS64BIT":0,"LABEL":"Fedora 15","MINIMAGESIZE":900,"CREATE_DT":"2011-05-25 18:57:36.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":85,"IS64BIT":1,"LABEL":"Fedora 15 64bit","MINIMAGESIZE":900,"CREATE_DT":"2011-05-25 18:58:07.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":79,"IS64BIT":0,"LABEL":"openSUSE 11.4","MINIMAGESIZE":650,"CREATE_DT":"2011-03-10 11:36:46.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":80,"IS64BIT":1,"LABEL":"openSUSE 11.4 64bit","MINIMAGESIZE":650,"CREATE_DT":"2011-03-10 11:36:46.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":68,"IS64BIT":0,"LABEL":"Slackware 13.1","MINIMAGESIZE":512,"CREATE_DT":"2010-05-10 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":69,"IS64BIT":1,"LABEL":"Slackware 13.1 64bit","MINIMAGESIZE":512,"CREATE_DT":"2010-05-10 00:00:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":73,"IS64BIT":0,"LABEL":"Ubuntu 10.10","MINIMAGESIZE":500,"CREATE_DT":"2010-10-11 15:19:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":74,"IS64BIT":1,"LABEL":"Ubuntu 10.10 64bit","MINIMAGESIZE":500,"CREATE_DT":"2010-10-11 15:19:00.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":82,"IS64BIT":0,"LABEL":"Ubuntu 11.04","MINIMAGESIZE":500,"CREATE_DT":"2011-04-28 16:28:48.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":83,"IS64BIT":1,"LABEL":"Ubuntu 11.04 64bit","MINIMAGESIZE":500,"CREATE_DT":"2011-04-28 16:28:48.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":41,"IS64BIT":0,"LABEL":"Ubuntu 8.04 LTS","MINIMAGESIZE":350,"CREATE_DT":"2008-04-23 15:11:29.0"},{"REQUIRESPVOPSKERNEL":1,"DISTRIBUTIONID":42,"IS64BIT":1,"LABEL":"Ubuntu 8.04 LTS 64bit","MINIMAGESIZE":350,"CREATE_DT":"2008-06-03 12:51:11.0"}],"ACTION":"avail.distributions"}'
|
273
|
+
json.stubs(:parsed_response).returns(JSON.parse(json))
|
262
274
|
HTTParty.stubs(:post).returns(json)
|
263
275
|
@linode.stubs(:api_url).returns('https://fake.linode.com/')
|
264
276
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 10
|
10
|
+
version: 0.7.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rick Bradley
|
@@ -15,9 +15,12 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-10-19 00:00:00 -05:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
type: :runtime
|
21
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
22
25
|
none: false
|
23
26
|
requirements:
|
@@ -27,11 +30,11 @@ dependencies:
|
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
30
|
-
version_requirements: *id001
|
31
33
|
name: httparty
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
32
36
|
prerelease: false
|
33
37
|
type: :runtime
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
36
39
|
none: false
|
37
40
|
requirements:
|
@@ -41,11 +44,11 @@ dependencies:
|
|
41
44
|
segments:
|
42
45
|
- 0
|
43
46
|
version: "0"
|
44
|
-
version_requirements: *id002
|
45
47
|
name: json
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
46
50
|
prerelease: false
|
47
51
|
type: :runtime
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
50
53
|
none: false
|
51
54
|
requirements:
|
@@ -57,11 +60,11 @@ dependencies:
|
|
57
60
|
- 4
|
58
61
|
- 4
|
59
62
|
version: 0.4.4
|
60
|
-
version_requirements: *id003
|
61
63
|
name: httparty
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
62
66
|
prerelease: false
|
63
67
|
type: :runtime
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
69
|
none: false
|
67
70
|
requirements:
|
@@ -73,10 +76,8 @@ dependencies:
|
|
73
76
|
- 3
|
74
77
|
- 1
|
75
78
|
version: 0.3.1
|
76
|
-
version_requirements: *id004
|
77
79
|
name: crack
|
78
|
-
|
79
|
-
type: :runtime
|
80
|
+
version_requirements: *id004
|
80
81
|
description: This is a wrapper around Linode's automation facilities.
|
81
82
|
email: rick@rickbradley.com
|
82
83
|
executables: []
|
@@ -126,6 +127,7 @@ files:
|
|
126
127
|
- spec/linode/user_spec.rb
|
127
128
|
- spec/linode_spec.rb
|
128
129
|
- spec/spec_helper.rb
|
130
|
+
has_rdoc: true
|
129
131
|
homepage: http://github.com/rick/linode
|
130
132
|
licenses: []
|
131
133
|
|
@@ -155,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
157
|
requirements: []
|
156
158
|
|
157
159
|
rubyforge_project:
|
158
|
-
rubygems_version: 1.
|
160
|
+
rubygems_version: 1.6.2
|
159
161
|
signing_key:
|
160
162
|
specification_version: 3
|
161
163
|
summary: a Ruby wrapper for the Linode API
|