podnix 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/podnix.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "podnix/api/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "podnix"
7
+ s.version = Podnix::API::VERSION
8
+ s.authors = ["Kishorekumar Neelamegam, Thomas Alrin, Rajthilak"]
9
+ s.email = ["nkishore@megam.co.in","alrin@megam.co.in", "rajthilak@megam.co.in"]
10
+ s.homepage = "http://github.com/indykish/podnix"
11
+ s.license = "Apache V2"
12
+ s.extra_rdoc_files = ["README.md", "LICENSE" ]
13
+ s.summary = %q{Ruby Client for the Podnix Cloud}
14
+ s.description = %q{Ruby Client for the Podnix Cloud. Performs REST based HTTP calls to https://api.podnix.com }
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+ s.add_runtime_dependency 'excon'
20
+ s.add_runtime_dependency 'highline'
21
+ s.add_runtime_dependency 'yajl-ruby'
22
+ s.add_runtime_dependency 'multi_json'
23
+ s.add_development_dependency 'minitest'
24
+ s.add_development_dependency 'rake'
25
+ end
@@ -0,0 +1,38 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../lib/podnix/api")
2
+
3
+ require 'rubygems'
4
+ gem 'minitest' # ensure we are using the gem version
5
+ require 'minitest/autorun'
6
+ require 'time'
7
+
8
+ SANDBOX_HOST_OPTIONS = {
9
+ :scheme => 'https',
10
+ :host => 'api.podnix.com',
11
+ :nonblock => false,
12
+ :port => 443
13
+
14
+ }
15
+
16
+ def nested_merge(other_hash={})
17
+ merge(other_hash) do |key, oldval, newval|
18
+ if oldval.is_a? Hash
19
+ oldval.nested_merge(newval)
20
+ else
21
+ newval
22
+ end
23
+ end
24
+ end
25
+
26
+ def podnix(options={})
27
+ s_options = SANDBOX_HOST_OPTIONS.merge({
28
+ :api_key => sandbox_apikey
29
+ })
30
+ options = s_options.merge(options)
31
+ mg=Podnix::API.new(options)
32
+ end
33
+
34
+ def sandbox_apikey
35
+ ENV['PODNIX_API_KEY']
36
+ end
37
+
38
+
@@ -0,0 +1,15 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+ class TestApps < MiniTest::Unit::TestCase
3
+ #=begin
4
+
5
+ def test_get_images
6
+
7
+ response = podnix.get_images
8
+ assert_equal(200, response.status)
9
+ end
10
+
11
+
12
+
13
+
14
+ end
15
+
@@ -0,0 +1,15 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+ class TestApps < MiniTest::Unit::TestCase
3
+ #=begin
4
+
5
+ def test_get_models
6
+
7
+ response = podnix.get_models
8
+ assert_equal(200, response.status)
9
+ end
10
+
11
+
12
+
13
+
14
+ end
15
+
@@ -0,0 +1,83 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+ class TestApps < MiniTest::Unit::TestCase
3
+
4
+
5
+ # https://api.podnix.com/servers/list?key=XXX
6
+ def test_get_servers
7
+ response = podnix.get_servers
8
+ #puts "=================> Response ========>"
9
+ #puts response.inspect
10
+ assert_equal(200, response.status)
11
+ end
12
+
13
+
14
+
15
+ #STATUS 0=pending, 1=running, 2=deleted, 3=stopped
16
+
17
+ def test_get_server
18
+ response = podnix.get_server({:id => '395'})
19
+ #puts "=================> Response ========>"
20
+ #puts response.inspect
21
+ assert_equal(200, response.status)
22
+ end
23
+
24
+ #---------------------------------
25
+ #MODELS ID VCORE RAM(GB)
26
+ #Small 1 1 2
27
+ #Medium 2 2 4
28
+ #Large 4 4 8
29
+ #Jumbo 8 8 16
30
+ #---------------------------------
31
+ #IMAGES ID
32
+ #Ubuntu 12.04.2 LTS (64bit) 2
33
+ #Ubuntu 13.04 (64bit) 37
34
+ #-----------------------------------
35
+ #PASSWORD
36
+ # Must contain at least 9 chars and include a lower case char, an upper case char and a number.
37
+
38
+ #SSD Not require,.If this parameter is set to 1, the system drive will be located on a SSD drive.
39
+
40
+ #STORAGE (10 - 200)
41
+
42
+ # https://api.podnix.com/servers/add?&name=test&model=1&image=2&password=Secret123&ssd=1&storage=10&key=XXX
43
+
44
+
45
+ def test_add_server
46
+ tmp_hash = {
47
+ :name => "tom.megam.co",
48
+ :model => "1",
49
+ :image => "37",
50
+ :password => "Team4megam",
51
+ :ssd => "1",
52
+ :storage => 10
53
+ }
54
+ response = podnix.add_server({
55
+ :name => "tom.megam.co",
56
+ :model => "1",
57
+ :image => "37",
58
+ :password => "Team4megam",
59
+ :ssd => "1",
60
+ :storage => '10'
61
+ })
62
+ assert_equal(201, response.status)
63
+ end
64
+
65
+ def test_start_Server
66
+ response = podnix.start_server({:id => '401'})
67
+ assert_equal(201, response.status)
68
+ end
69
+
70
+
71
+
72
+ def test_stop_Server
73
+ response = podnix.stop_server({:id => '401'})
74
+ assert_equal(201, response.status)
75
+ end
76
+
77
+ def test_delete_Server
78
+ response = podnix.delete_server({:id => '401'})
79
+ assert_equal(201, response.status)
80
+ end
81
+
82
+ end
83
+
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: podnix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kishorekumar Neelamegam, Thomas Alrin, Rajthilak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: excon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: highline
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yajl-ruby
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: multi_json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: 'Ruby Client for the Podnix Cloud. Performs REST based HTTP calls to
98
+ https://api.podnix.com '
99
+ email:
100
+ - nkishore@megam.co.in
101
+ - alrin@megam.co.in
102
+ - rajthilak@megam.co.in
103
+ executables: []
104
+ extensions: []
105
+ extra_rdoc_files:
106
+ - README.md
107
+ - LICENSE
108
+ files:
109
+ - .gitignore
110
+ - .project
111
+ - .travis.yml
112
+ - Gemfile
113
+ - LICENSE
114
+ - README.md
115
+ - Rakefile
116
+ - lib/certs/cacert.pem
117
+ - lib/podnix.rb
118
+ - lib/podnix/api.rb
119
+ - lib/podnix/api/errors.rb
120
+ - lib/podnix/api/images.rb
121
+ - lib/podnix/api/models.rb
122
+ - lib/podnix/api/servers.rb
123
+ - lib/podnix/api/version.rb
124
+ - lib/podnix/core/auth.rb
125
+ - lib/podnix/core/config.rb
126
+ - lib/podnix/core/error.rb
127
+ - lib/podnix/core/images.rb
128
+ - lib/podnix/core/images_collection.rb
129
+ - lib/podnix/core/json_compat.rb
130
+ - lib/podnix/core/server.rb
131
+ - lib/podnix/core/server_collection.rb
132
+ - lib/podnix/core/stuff.rb
133
+ - lib/podnix/core/text.rb
134
+ - podnix.gemspec
135
+ - test/test_helper.rb
136
+ - test/test_images.rb
137
+ - test/test_models.rb
138
+ - test/test_servers.rb
139
+ homepage: http://github.com/indykish/podnix
140
+ licenses:
141
+ - Apache V2
142
+ metadata: {}
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubyforge_project:
159
+ rubygems_version: 2.1.11
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: Ruby Client for the Podnix Cloud
163
+ test_files: []