fog-cloudatcost 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +28 -0
  3. data/.gitignore +37 -0
  4. data/.rubocop.yml +1168 -0
  5. data/.travis.yml +38 -0
  6. data/Gemfile +5 -0
  7. data/Gemfile.lock +69 -0
  8. data/LICENSE +22 -0
  9. data/README.md +5 -0
  10. data/Rakefile +21 -0
  11. data/fog-cloudatcost.gemspec +32 -0
  12. data/gemfiles/Gemfile-edge +9 -0
  13. data/lib/fog/cloudatcost.rb +5 -0
  14. data/lib/fog/cloudatcost/compute.rb +80 -0
  15. data/lib/fog/cloudatcost/core.rb +9 -0
  16. data/lib/fog/cloudatcost/examples/getting_started.md +82 -0
  17. data/lib/fog/cloudatcost/models/server.rb +96 -0
  18. data/lib/fog/cloudatcost/models/servers.rb +28 -0
  19. data/lib/fog/cloudatcost/models/task.rb +21 -0
  20. data/lib/fog/cloudatcost/models/tasks.rb +28 -0
  21. data/lib/fog/cloudatcost/models/template.rb +10 -0
  22. data/lib/fog/cloudatcost/models/templates.rb +28 -0
  23. data/lib/fog/cloudatcost/requests/console.rb +32 -0
  24. data/lib/fog/cloudatcost/requests/create_server.rb +33 -0
  25. data/lib/fog/cloudatcost/requests/delete_server.rb +33 -0
  26. data/lib/fog/cloudatcost/requests/list_servers.rb +28 -0
  27. data/lib/fog/cloudatcost/requests/list_tasks.rb +28 -0
  28. data/lib/fog/cloudatcost/requests/list_templates.rb +28 -0
  29. data/lib/fog/cloudatcost/requests/power_off.rb +34 -0
  30. data/lib/fog/cloudatcost/requests/power_on.rb +34 -0
  31. data/lib/fog/cloudatcost/requests/rename_server.rb +32 -0
  32. data/lib/fog/cloudatcost/requests/reset.rb +34 -0
  33. data/lib/fog/cloudatcost/requests/reverse_dns.rb +32 -0
  34. data/lib/fog/cloudatcost/requests/run_mode.rb +32 -0
  35. data/lib/fog/cloudatcost/version.rb +5 -0
  36. data/spec/fog/models/server_spec.rb +18 -0
  37. data/spec/fog/models/servers_spec.rb +11 -0
  38. data/spec/fog/models/task_spec.rb +58 -0
  39. data/spec/fog/models/tasks_spec.rb +11 -0
  40. data/spec/fog/models/template_spec.rb +14 -0
  41. data/spec/fog/models/templates_spec.rb +11 -0
  42. data/spec/model_setup.rb +14 -0
  43. data/spec/spec_helper.rb +5 -0
  44. metadata +208 -0
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Compute
3
+ class CloudAtCost
4
+ class Real
5
+ def reverse_dns(id, host_name)
6
+ body = { :sid => "#{id}", :hostname => "#{host_name}" }
7
+ request(
8
+ :expects => [200],
9
+ :method => 'POST',
10
+ :path => 'api/v1/rdns.php',
11
+ :body => body,
12
+ )
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def reverse_dns(id, hostname)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = {
21
+ 'server_id' => Fog::Mock.random_numbers(1).to_i,
22
+ 'api' => 'v1',
23
+ 'status' => 'ok',
24
+ 'result' => 'successful',
25
+ 'time' => 12312323,
26
+ }
27
+ response
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Compute
3
+ class CloudAtCost
4
+ class Real
5
+ def run_mode(id, action)
6
+ body = { :sid => "#{id}", :mode => "#{action}" }
7
+ request(
8
+ :expects => [200],
9
+ :method => 'POST',
10
+ :path => 'api/v1/runmode.php',
11
+ :body => body,
12
+ )
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def run_mode(id, action)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = {
21
+ 'server_id' => Fog::Mock.random_numbers(1).to_i,
22
+ 'api' => 'v1',
23
+ 'status' => 'ok',
24
+ 'result' => 'successful',
25
+ 'time' => 12312323,
26
+ }
27
+ response
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module Fog
2
+ module CloudAtCost
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+ require 'fog/cloudatcost/models/server'
3
+
4
+ describe Fog::Compute::CloudAtCost::Server do
5
+ let(:server) { Fog::Compute::CloudAtCost::Server.new }
6
+
7
+ server_attributes = %w(sid id CustID packageid label servername
8
+ vmname ip netmask gateway hostname rootpass
9
+ vncport vncpass servertype template cpu cpuusage
10
+ ram ramusage storage hdusage sdate status panel_note
11
+ mode uid rdns rdnsdefault template_id)
12
+
13
+ it 'tests attributes' do
14
+ server_attributes.each do |attribute|
15
+ expect(server).to respond_to(attribute)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+ require 'fog/cloudatcost/models/servers'
3
+
4
+ describe Fog::Compute::CloudAtCost::Servers do
5
+ subject { Fog::Compute::CloudAtCost::Servers }
6
+
7
+ it 'should have a collection of servers' do
8
+ expect(subject.model).to eq(Fog::Compute::CloudAtCost::Server)
9
+ end
10
+ end
11
+
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+ require 'fog/cloudatcost/models/task'
3
+
4
+ describe Fog::Compute::CloudAtCost::Task do
5
+ let(:server) { Fog::Compute::CloudAtCost::Task.new }
6
+
7
+ it 'respond to #id' do
8
+ server.respond_to? :id
9
+ end
10
+
11
+ it 'respond to #cid' do
12
+ server.respond_to? :cid
13
+ end
14
+
15
+ it 'respond to #idf' do
16
+ server.respond_to? :idf
17
+ end
18
+
19
+ it 'respond to #serverid' do
20
+ server.respond_to? :serverid
21
+ end
22
+
23
+ it 'respond to #action' do
24
+ server.respond_to? :action
25
+ end
26
+
27
+ it 'respond to #status' do
28
+ server.respond_to? :status
29
+ end
30
+
31
+ it 'respond to #starttime' do
32
+ server.respond_to? :starttime
33
+ end
34
+
35
+ it 'respond to #finishtime' do
36
+ server.respond_to? :finishtime
37
+ end
38
+
39
+ it 'respond to #servername' do
40
+ server.respond_to? :servername
41
+ end
42
+
43
+ it 'respond to #ip' do
44
+ server.respond_to? :ip
45
+ end
46
+
47
+ it 'respond to #label' do
48
+ server.respond_to? :label
49
+ end
50
+
51
+ it 'respond to #rdns' do
52
+ server.respond_to? :rdns
53
+ end
54
+
55
+ it 'respond to #rdnsdefault' do
56
+ server.respond_to? :rdnsdefault
57
+ end
58
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+ require 'fog/cloudatcost/models/tasks'
3
+
4
+ describe Fog::Compute::CloudAtCost::Tasks do
5
+ subject { Fog::Compute::CloudAtCost::Tasks }
6
+
7
+ it 'should have a collection of tasks' do
8
+ expect(subject.model).to eq(Fog::Compute::CloudAtCost::Task)
9
+ end
10
+ end
11
+
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+ require 'fog/cloudatcost/models/template'
3
+
4
+ describe Fog::Compute::CloudAtCost::Template do
5
+ let(:server) { Fog::Compute::CloudAtCost::Template.new }
6
+
7
+ it 'respond to #id' do
8
+ server.respond_to? :id
9
+ end
10
+
11
+ it 'respond to #detail' do
12
+ server.respond_to? :detail
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+ require 'fog/cloudatcost/models/templates'
3
+
4
+ describe Fog::Compute::CloudAtCost::Templates do
5
+ subject { Fog::Compute::CloudAtCost::Templates }
6
+
7
+ it 'should have a collection of templates' do
8
+ expect(subject.model).to eq(Fog::Compute::CloudAtCost::Template)
9
+ end
10
+ end
11
+
@@ -0,0 +1,14 @@
1
+ module ModelSetup
2
+ def self.included(base)
3
+ base.class_eval do
4
+ let(:arguments) do
5
+ {
6
+ :api => ''
7
+ }
8
+ end
9
+
10
+ # Initialize the service object to be used inside models tests
11
+ let(:service) { Fog::Compute::CloudAtCost.new(arguments) }
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ require 'fog/cloudatcost'
2
+ require 'model_setup'
3
+
4
+ require 'codeclimate-test-reporter'
5
+ CodeClimate::TestReporter.start
metadata ADDED
@@ -0,0 +1,208 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fog-cloudatcost
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Suraj Shirvankar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.4.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubyzip
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.9
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.9
69
+ - !ruby/object:Gem::Dependency
70
+ name: fog-core
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.27'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.27'
83
+ - !ruby/object:Gem::Dependency
84
+ name: fog-json
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fog-xml
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: ipaddress
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.8'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.8'
125
+ description: |-
126
+ This library can be used as a module for `fog` or as standalone provider
127
+ to use the Amazon Web Services in applications..
128
+ email:
129
+ - surajshirvankar@gmail.com
130
+ executables: []
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - ".codeclimate.yml"
135
+ - ".gitignore"
136
+ - ".rubocop.yml"
137
+ - ".travis.yml"
138
+ - Gemfile
139
+ - Gemfile.lock
140
+ - LICENSE
141
+ - README.md
142
+ - Rakefile
143
+ - fog-cloudatcost.gemspec
144
+ - gemfiles/Gemfile-edge
145
+ - lib/fog/cloudatcost.rb
146
+ - lib/fog/cloudatcost/compute.rb
147
+ - lib/fog/cloudatcost/core.rb
148
+ - lib/fog/cloudatcost/examples/getting_started.md
149
+ - lib/fog/cloudatcost/models/server.rb
150
+ - lib/fog/cloudatcost/models/servers.rb
151
+ - lib/fog/cloudatcost/models/task.rb
152
+ - lib/fog/cloudatcost/models/tasks.rb
153
+ - lib/fog/cloudatcost/models/template.rb
154
+ - lib/fog/cloudatcost/models/templates.rb
155
+ - lib/fog/cloudatcost/requests/console.rb
156
+ - lib/fog/cloudatcost/requests/create_server.rb
157
+ - lib/fog/cloudatcost/requests/delete_server.rb
158
+ - lib/fog/cloudatcost/requests/list_servers.rb
159
+ - lib/fog/cloudatcost/requests/list_tasks.rb
160
+ - lib/fog/cloudatcost/requests/list_templates.rb
161
+ - lib/fog/cloudatcost/requests/power_off.rb
162
+ - lib/fog/cloudatcost/requests/power_on.rb
163
+ - lib/fog/cloudatcost/requests/rename_server.rb
164
+ - lib/fog/cloudatcost/requests/reset.rb
165
+ - lib/fog/cloudatcost/requests/reverse_dns.rb
166
+ - lib/fog/cloudatcost/requests/run_mode.rb
167
+ - lib/fog/cloudatcost/version.rb
168
+ - spec/fog/models/server_spec.rb
169
+ - spec/fog/models/servers_spec.rb
170
+ - spec/fog/models/task_spec.rb
171
+ - spec/fog/models/tasks_spec.rb
172
+ - spec/fog/models/template_spec.rb
173
+ - spec/fog/models/templates_spec.rb
174
+ - spec/model_setup.rb
175
+ - spec/spec_helper.rb
176
+ homepage: http://github.com/fog/fog-cloudatcost
177
+ licenses:
178
+ - MIT
179
+ metadata: {}
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ requirements: []
195
+ rubyforge_project:
196
+ rubygems_version: 2.5.1
197
+ signing_key:
198
+ specification_version: 4
199
+ summary: Module for the 'fog' gem to support CloudAtCost.
200
+ test_files:
201
+ - spec/fog/models/server_spec.rb
202
+ - spec/fog/models/servers_spec.rb
203
+ - spec/fog/models/task_spec.rb
204
+ - spec/fog/models/tasks_spec.rb
205
+ - spec/fog/models/template_spec.rb
206
+ - spec/fog/models/templates_spec.rb
207
+ - spec/model_setup.rb
208
+ - spec/spec_helper.rb