linodeapi 0.2.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -5
- data/circle.yml +12 -0
- data/dev/spec.yml +10 -6
- data/lib/linodeapi/raw.rb +1 -1
- data/linodeapi.gemspec +5 -4
- data/spec/fixtures/cassettes/basic_auth.yml +448 -0
- data/spec/fixtures/cassettes/basic_auth_fail.yml +42 -0
- data/spec/fixtures/cassettes/kernel_list.yml +51 -0
- data/spec/fixtures/cassettes/linode_list.yml +42 -0
- data/spec/fixtures/cassettes/no_creds.yml +370 -0
- data/spec/fixtures/cassettes/test_echo.yml +42 -0
- data/spec/linodeapi/raw_spec.rb +72 -0
- data/spec/linodeapi_spec.rb +11 -2
- data/spec/spec_helper.rb +16 -6
- metadata +41 -12
- data/.travis.yml +0 -17
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.linode.com/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: api_key=<APIKEY>&api_action=test.echo
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Thu, 29 Oct 2015 02:01:46 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=UTF-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Powered-By:
|
32
|
+
- Tiger Blood
|
33
|
+
Access-Control-Allow-Origin:
|
34
|
+
- "*"
|
35
|
+
Strict-Transport-Security:
|
36
|
+
- max-age=31536000
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"ERRORARRAY":[],"DATA":{},"ACTION":"test.echo"}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Thu, 29 Oct 2015 02:01:47 GMT
|
42
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
USERNAME = ENV['LINODE_USERNAME'] || 'test'
|
4
|
+
PASSWORD = ENV['LINODE_PASSWORD'] || 'test'
|
5
|
+
APIKEY = ENV['LINODE_APIKEY'] || 'test'
|
6
|
+
|
7
|
+
describe LinodeAPI::Raw do
|
8
|
+
let(:subject) do
|
9
|
+
LinodeAPI::Raw.new(apikey: APIKEY)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'requires credentials' do
|
13
|
+
VCR.use_cassette('no_creds') do
|
14
|
+
expect { LinodeAPI::Raw.new }.to raise_error ArgumentError
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'fails if the username/password are invalid' do
|
19
|
+
VCR.use_cassette('basic_auth_fail') do
|
20
|
+
expect do
|
21
|
+
LinodeAPI::Raw.new(username: 'bad', password: 'bad')
|
22
|
+
end.to raise_error RuntimeError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'accepts valid username/password' do
|
27
|
+
VCR.use_cassette('basic_auth') do
|
28
|
+
api = LinodeAPI::Raw.new(username: USERNAME, password: PASSWORD)
|
29
|
+
expect(api.test.echo).to be_an_instance_of OpenStruct
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'accepts a valid api key' do
|
34
|
+
VCR.use_cassette('test_echo') do
|
35
|
+
expect(subject.test.echo).to be_an_instance_of OpenStruct
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'has a to_s representation' do
|
40
|
+
expect(subject.to_s).to eql 'LinodeAPI::Raw object'
|
41
|
+
expect(subject.inspect).to eql 'LinodeAPI::Raw object'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'accurately responds to .respond_to?' do
|
45
|
+
expect(subject.respond_to? :linode).to be_truthy
|
46
|
+
expect(subject.respond_to? :list).to be_falsey
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'returns arrays for list calls' do
|
50
|
+
VCR.use_cassette('linode_list') do
|
51
|
+
expect(subject.linode.list.class).to eql Array
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'fails if a required param is missing' do
|
56
|
+
expect { subject.linode.create }.to raise_error ArgumentError
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'converts boolean params to true/false' do
|
60
|
+
VCR.use_cassette('kernel_list') do
|
61
|
+
expect(
|
62
|
+
subject.avail.kernels(isxen: 'word').all? { |x| x.isxen == 1 }
|
63
|
+
).to be_truthy
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'raises a validation error on invalid numeric params' do
|
68
|
+
expect do
|
69
|
+
subject.avail.linodeplans(planid: 'word')
|
70
|
+
end.to raise_error ArgumentError
|
71
|
+
end
|
72
|
+
end
|
data/spec/linodeapi_spec.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LinodeAPI do
|
4
|
-
it '
|
5
|
-
expect(
|
4
|
+
it 'has a default endpoint' do
|
5
|
+
expect(LinodeAPI::DEFAULT_ENDPOINT).to be_an_instance_of String
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'has a spec URL' do
|
9
|
+
expect(LinodeAPI::SPEC_URL).to be_an_instance_of String
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'makes the spec available' do
|
13
|
+
expect(LinodeAPI.spec[:subs]).to be_an_instance_of Hash
|
14
|
+
expect(LinodeAPI.spec[:subs][:linode][:subs][:create][:type]).to eql :call
|
6
15
|
end
|
7
16
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
|
-
|
2
|
-
require '
|
3
|
-
|
4
|
-
SimpleCov.formatter =
|
5
|
-
SimpleCov.start do
|
6
|
-
|
1
|
+
if ENV['CI'] == 'true'
|
2
|
+
require 'simplecov'
|
3
|
+
require 'codecov'
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter '/spec/'
|
7
|
+
end
|
7
8
|
end
|
8
9
|
|
9
10
|
require 'rspec'
|
10
11
|
require 'linodeapi'
|
12
|
+
|
13
|
+
require 'vcr'
|
14
|
+
VCR.configure do |c|
|
15
|
+
c.cassette_library_dir = 'spec/fixtures/cassettes'
|
16
|
+
c.hook_into :webmock
|
17
|
+
c.filter_sensitive_data('<USER>') { ENV['LINODE_USERNAME'] || 'test' }
|
18
|
+
c.filter_sensitive_data('<PASSWORD>') { ENV['LINODE_PASSWORD'] || 'test' }
|
19
|
+
c.filter_sensitive_data('<APIKEY>') { ENV['LINODE_APIKEY'] || 'test' }
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linodeapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.34.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.34.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 10.4.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: codecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.1.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.1.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,19 +95,33 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 2.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 1.22.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 1.22.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: vcr
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.9.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.9.2
|
111
125
|
description: Wraps the Linode API with multiple levels of interaction
|
112
126
|
email: me@lesaker.org
|
113
127
|
executables: []
|
@@ -117,16 +131,24 @@ files:
|
|
117
131
|
- ".gitignore"
|
118
132
|
- ".rspec"
|
119
133
|
- ".rubocop.yml"
|
120
|
-
-
|
134
|
+
- CHANGELOG.md
|
121
135
|
- Gemfile
|
122
136
|
- LICENSE
|
123
137
|
- README.md
|
124
138
|
- Rakefile
|
139
|
+
- circle.yml
|
125
140
|
- dev/cache_spec.rb
|
126
141
|
- dev/spec.yml
|
127
142
|
- lib/linodeapi.rb
|
128
143
|
- lib/linodeapi/raw.rb
|
129
144
|
- linodeapi.gemspec
|
145
|
+
- spec/fixtures/cassettes/basic_auth.yml
|
146
|
+
- spec/fixtures/cassettes/basic_auth_fail.yml
|
147
|
+
- spec/fixtures/cassettes/kernel_list.yml
|
148
|
+
- spec/fixtures/cassettes/linode_list.yml
|
149
|
+
- spec/fixtures/cassettes/no_creds.yml
|
150
|
+
- spec/fixtures/cassettes/test_echo.yml
|
151
|
+
- spec/linodeapi/raw_spec.rb
|
130
152
|
- spec/linodeapi_spec.rb
|
131
153
|
- spec/spec_helper.rb
|
132
154
|
homepage: https://github.com/akerl/linodeapi
|
@@ -149,10 +171,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
171
|
version: '0'
|
150
172
|
requirements: []
|
151
173
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.4.5
|
174
|
+
rubygems_version: 2.4.5.1
|
153
175
|
signing_key:
|
154
176
|
specification_version: 4
|
155
177
|
summary: Linode API wrapper
|
156
178
|
test_files:
|
179
|
+
- spec/fixtures/cassettes/basic_auth.yml
|
180
|
+
- spec/fixtures/cassettes/basic_auth_fail.yml
|
181
|
+
- spec/fixtures/cassettes/kernel_list.yml
|
182
|
+
- spec/fixtures/cassettes/linode_list.yml
|
183
|
+
- spec/fixtures/cassettes/no_creds.yml
|
184
|
+
- spec/fixtures/cassettes/test_echo.yml
|
185
|
+
- spec/linodeapi/raw_spec.rb
|
157
186
|
- spec/linodeapi_spec.rb
|
158
187
|
- spec/spec_helper.rb
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
4
|
-
rvm:
|
5
|
-
- 2.2.2
|
6
|
-
- 2.2.1
|
7
|
-
- 2.2.0
|
8
|
-
- 2.1.6
|
9
|
-
- 2.0.0-p598
|
10
|
-
- 1.9.3-p551
|
11
|
-
notifications:
|
12
|
-
email: false
|
13
|
-
irc:
|
14
|
-
template:
|
15
|
-
- "%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}"
|
16
|
-
channels:
|
17
|
-
- irc.oftc.net#akerl
|