podnix 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/lib/podnix/api.rb +7 -13
- data/lib/podnix/api/servers.rb +1 -1
- data/lib/podnix/api/version.rb +1 -1
- data/test/test_helper.rb +1 -10
- data/test/test_images.rb +2 -0
- data/test/test_servers.rb +0 -4
- metadata +2 -11
- data/lib/podnix/core/auth.rb +0 -91
- data/lib/podnix/core/config.rb +0 -44
- data/lib/podnix/core/error.rb +0 -97
- data/lib/podnix/core/images.rb +0 -239
- data/lib/podnix/core/images_collection.rb +0 -148
- data/lib/podnix/core/json_compat.rb +0 -162
- data/lib/podnix/core/server.rb +0 -375
- data/lib/podnix/core/server_collection.rb +0 -166
- data/lib/podnix/core/stuff.rb +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a349b4dd9627768d083336b20bb6bc9edc8137a8
|
4
|
+
data.tar.gz: 6ea2a8b1a4d1ac62331d731f70e9c89f7d8027ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76783f66dcc6572d0ee902ddd8854f5fdee4050d10be68da51aec442566122d4bff0ac18bc71d67b636630874c7376b36b9923dc2e50e29171df75d44de5cb5e
|
7
|
+
data.tar.gz: 88d5c594b87b44570aa4e5f4d6071fc8e2961b8984c90520895614ad846b40c8ed4b6d3d6122b832e440ab12f2dea5300651dc13660c7f68850985456400b0cd
|
data/lib/podnix/api.rb
CHANGED
@@ -19,14 +19,7 @@ require "podnix/api/version"
|
|
19
19
|
require "podnix/api/images"
|
20
20
|
require "podnix/api/models"
|
21
21
|
require "podnix/api/servers"
|
22
|
-
require "podnix/core/stuff"
|
23
22
|
require "podnix/core/text"
|
24
|
-
require "podnix/core/json_compat"
|
25
|
-
require "podnix/core/error"
|
26
|
-
require "podnix/core/images"
|
27
|
-
require "podnix/core/images_collection"
|
28
|
-
require "podnix/core/server"
|
29
|
-
require "podnix/core/server_collection"
|
30
23
|
|
31
24
|
#we may nuke logs out of the api
|
32
25
|
#require "megam/api/logs"
|
@@ -49,7 +42,6 @@ module Podnix
|
|
49
42
|
}
|
50
43
|
|
51
44
|
QUERY = {
|
52
|
-
:key => ENV['PODNIX_API_KEY']
|
53
45
|
}
|
54
46
|
|
55
47
|
OPTIONS = {
|
@@ -79,9 +71,9 @@ module Podnix
|
|
79
71
|
# 3. Upon merge of the options, the api_key, email as available in the @options is deleted.
|
80
72
|
def initialize(options={})
|
81
73
|
@options = OPTIONS.merge(options)
|
82
|
-
|
83
|
-
|
84
|
-
raise ArgumentError, "You must specify [
|
74
|
+
@key = options[:key]
|
75
|
+
@options[:query] = QUERY.merge(options)
|
76
|
+
raise ArgumentError, "You must specify podnix_api_key in knife.rb or ENV['PODNIX_API_KEY']" if @key.empty? && !ENV['PODNIX_API_KEY']
|
85
77
|
end
|
86
78
|
|
87
79
|
def request(params,&block)
|
@@ -163,8 +155,10 @@ module Podnix
|
|
163
155
|
#Make a lazy connection.
|
164
156
|
def connection
|
165
157
|
|
166
|
-
|
167
|
-
|
158
|
+
if ENV['PODNIX_API_KEY'] && @options[:query][:key].empty?
|
159
|
+
QUERY[:key]="#{ENV['PODNIX_API_KEY']}"
|
160
|
+
@options[:query] = @options[:query].merge(QUERY)
|
161
|
+
end
|
168
162
|
@options[:headers] = HEADERS.merge(@options[:headers])
|
169
163
|
|
170
164
|
#SSL certificate file paths
|
data/lib/podnix/api/servers.rb
CHANGED
data/lib/podnix/api/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -13,16 +13,7 @@ SANDBOX_HOST_OPTIONS = {
|
|
13
13
|
|
14
14
|
}
|
15
15
|
|
16
|
-
|
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
|
-
|
16
|
+
|
26
17
|
def podnix(options={})
|
27
18
|
s_options = SANDBOX_HOST_OPTIONS.merge({
|
28
19
|
:api_key => sandbox_apikey
|
data/test/test_images.rb
CHANGED
data/test/test_servers.rb
CHANGED
@@ -5,8 +5,6 @@ class TestApps < MiniTest::Unit::TestCase
|
|
5
5
|
# https://api.podnix.com/servers/list?key=XXX
|
6
6
|
def test_get_servers
|
7
7
|
response = podnix.get_servers
|
8
|
-
#puts "=================> Response ========>"
|
9
|
-
#puts response.inspect
|
10
8
|
assert_equal(200, response.status)
|
11
9
|
end
|
12
10
|
|
@@ -16,8 +14,6 @@ class TestApps < MiniTest::Unit::TestCase
|
|
16
14
|
|
17
15
|
def test_get_server
|
18
16
|
response = podnix.get_server({:id => '395'})
|
19
|
-
#puts "=================> Response ========>"
|
20
|
-
#puts response.inspect
|
21
17
|
assert_equal(200, response.status)
|
22
18
|
end
|
23
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: podnix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kishorekumar Neelamegam, Thomas Alrin, Rajthilak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -121,15 +121,6 @@ files:
|
|
121
121
|
- lib/podnix/api/models.rb
|
122
122
|
- lib/podnix/api/servers.rb
|
123
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
124
|
- lib/podnix/core/text.rb
|
134
125
|
- podnix.gemspec
|
135
126
|
- test/test_helper.rb
|
data/lib/podnix/core/auth.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2012-2013 Megam Systems, Inc.
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
module Podnix
|
17
|
-
class Auth
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
@some_msg = {}
|
21
|
-
end
|
22
|
-
|
23
|
-
#used by resque workers and any other background job
|
24
|
-
def auth
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
def podnix_rest
|
29
|
-
Podnix::API.new(Podnix::Config[:email], Podnix::Config[:api_key])
|
30
|
-
end
|
31
|
-
|
32
|
-
def some_msg(arg=nil)
|
33
|
-
if arg != nil
|
34
|
-
@some_msg = arg
|
35
|
-
else
|
36
|
-
@some_msg
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def error?
|
41
|
-
crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
|
42
|
-
end
|
43
|
-
|
44
|
-
# Transform the ruby obj -> to a Hash
|
45
|
-
def to_hash
|
46
|
-
index_hash = Hash.new
|
47
|
-
index_hash["json_claz"] = self.class.name
|
48
|
-
index_hash["some_msg"] = some_msg
|
49
|
-
index_hash
|
50
|
-
end
|
51
|
-
|
52
|
-
# Serialize this object as a hash: called from JsonCompat.
|
53
|
-
# Verify if this called from JsonCompat during testing.
|
54
|
-
def to_json(*a)
|
55
|
-
for_json.to_json(*a)
|
56
|
-
end
|
57
|
-
|
58
|
-
def for_json
|
59
|
-
result = { }
|
60
|
-
result
|
61
|
-
end
|
62
|
-
|
63
|
-
# Create a Podnix::Account from JSON (used by the backgroud job workers)
|
64
|
-
def self.json_create(o)
|
65
|
-
acct = new
|
66
|
-
acct.some_msg[:code] = o["code"] if o.has_key?("code")
|
67
|
-
acct.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
68
|
-
acct.some_msg[:msg]= o["msg"] if o.has_key?("msg")
|
69
|
-
acct.some_msg[:links] = o["links"] if o.has_key?("links")
|
70
|
-
acct
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.from_hash(o)
|
74
|
-
acct = self.new()
|
75
|
-
acct.from_hash(o)
|
76
|
-
acct
|
77
|
-
end
|
78
|
-
|
79
|
-
# just an auth
|
80
|
-
def self.auth
|
81
|
-
podnix_rest.post_auth
|
82
|
-
self
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
def to_s
|
87
|
-
Podnix::Stuff.styled_hash(to_hash)
|
88
|
-
#"---> Megam::Account:[error=#{error?}]\n"+
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
data/lib/podnix/core/config.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2012-2013 Megam Systems.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'mixlib/config'
|
18
|
-
|
19
|
-
module Podnix
|
20
|
-
class Config
|
21
|
-
|
22
|
-
extend Mixlib::Config
|
23
|
-
|
24
|
-
def self.inspect
|
25
|
-
configuration.inspect
|
26
|
-
end
|
27
|
-
|
28
|
-
podnix_api_server_url "http://localhost:9000"
|
29
|
-
|
30
|
-
podnix_api_version "v1"
|
31
|
-
|
32
|
-
email nil
|
33
|
-
api_key nil
|
34
|
-
|
35
|
-
# Set these to enable SSL authentication / mutual-authentication
|
36
|
-
# with the server
|
37
|
-
ssl_client_cert nil
|
38
|
-
ssl_client_key nil
|
39
|
-
ssl_verify_mode :verify_none
|
40
|
-
ssl_ca_path nil
|
41
|
-
ssl_ca_file nil
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
data/lib/podnix/core/error.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2012-2013 Megam Systems, Inc.
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
module Podnix
|
17
|
-
class Error
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
@some_msg = {}
|
21
|
-
end
|
22
|
-
|
23
|
-
#used by resque workers and any other background job
|
24
|
-
def auth
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
def podnix_rest
|
29
|
-
Podnix::API.new(Podnix::Config[:email], Podnix::Config[:api_key])
|
30
|
-
end
|
31
|
-
|
32
|
-
def some_msg(arg=nil)
|
33
|
-
if arg != nil
|
34
|
-
@some_msg = arg
|
35
|
-
else
|
36
|
-
@some_msg
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def error?
|
41
|
-
crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
|
42
|
-
end
|
43
|
-
|
44
|
-
# Transform the ruby obj -> to a Hash
|
45
|
-
def to_hash
|
46
|
-
index_hash = Hash.new
|
47
|
-
index_hash["json_claz"] = self.class.name
|
48
|
-
index_hash["some_msg"] = some_msg
|
49
|
-
index_hash
|
50
|
-
end
|
51
|
-
|
52
|
-
# Serialize this object as a hash: called from JsonCompat.
|
53
|
-
# Verify if this called from JsonCompat during testing.
|
54
|
-
def to_json(*a)
|
55
|
-
for_json.to_json(*a)
|
56
|
-
end
|
57
|
-
|
58
|
-
def for_json
|
59
|
-
result = { }
|
60
|
-
result
|
61
|
-
end
|
62
|
-
|
63
|
-
# Create a Megam::Account from JSON (used by the backgroud job workers)
|
64
|
-
def self.json_create(o)
|
65
|
-
acct = new
|
66
|
-
acct.some_msg[:code] = o["code"] if o.has_key?("code")
|
67
|
-
acct.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
68
|
-
acct.some_msg[:msg]= o["msg"] if o.has_key?("msg")
|
69
|
-
acct.some_msg[:links] = o["links"] if o.has_key?("links")
|
70
|
-
acct
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.from_hash(o)
|
74
|
-
acct = self.new()
|
75
|
-
acct.from_hash(o)
|
76
|
-
acct
|
77
|
-
end
|
78
|
-
|
79
|
-
def from_hash(o)
|
80
|
-
@some_msg[:code] = o["code"] if o.has_key?("code")
|
81
|
-
@some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
82
|
-
@some_msg[:msg]= o["msg"] if o.has_key?("msg")
|
83
|
-
@some_msg[:links] = o["links"] if o.has_key?("links")
|
84
|
-
self
|
85
|
-
end
|
86
|
-
|
87
|
-
# just an auth
|
88
|
-
def self.auth
|
89
|
-
podnix_rest.post_auth
|
90
|
-
self
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
def to_s
|
95
|
-
Podnix::Stuff.styled_hash(to_hash) end
|
96
|
-
end
|
97
|
-
end
|
data/lib/podnix/core/images.rb
DELETED
@@ -1,239 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2012, 2013 Megam Systems
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
module Podnix
|
17
|
-
class AppRequest
|
18
|
-
# Each notify entry is a resource/action pair, modeled as an
|
19
|
-
# Struct with a #resource and #action member
|
20
|
-
=begin
|
21
|
-
def self.hash_tree
|
22
|
-
Hash.new do |hash, key|
|
23
|
-
hash[key] = hash_tree
|
24
|
-
end
|
25
|
-
end
|
26
|
-
=end
|
27
|
-
|
28
|
-
def initialize
|
29
|
-
@id = nil
|
30
|
-
@req_type = nil
|
31
|
-
@appdefns_id = nil
|
32
|
-
@node_name = nil
|
33
|
-
@lc_apply = nil
|
34
|
-
@lc_additional = nil
|
35
|
-
@lc_when = nil
|
36
|
-
@created_at = nil
|
37
|
-
@some_msg = {}
|
38
|
-
end
|
39
|
-
def appreq
|
40
|
-
self
|
41
|
-
end
|
42
|
-
|
43
|
-
def podnix_rest
|
44
|
-
options = { :email => Megam::Config[:email], :api_key => Megam::Config[:api_key]}
|
45
|
-
Podnix::API.new(options)
|
46
|
-
end
|
47
|
-
|
48
|
-
def id(arg=nil)
|
49
|
-
if arg != nil
|
50
|
-
@id = arg
|
51
|
-
else
|
52
|
-
@id
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def req_type(arg=nil)
|
57
|
-
if arg != nil
|
58
|
-
@req_type = arg
|
59
|
-
else
|
60
|
-
@req_type
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def appdefns_id(arg=nil)
|
65
|
-
if arg != nil
|
66
|
-
@appdefns_id = arg
|
67
|
-
else
|
68
|
-
@appdefns_id
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def node_name(arg=nil)
|
73
|
-
if arg != nil
|
74
|
-
@node_name = arg
|
75
|
-
else
|
76
|
-
@node_name
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def lc_apply(arg=nil)
|
81
|
-
if arg != nil
|
82
|
-
@lc_apply = arg
|
83
|
-
else
|
84
|
-
@lc_apply
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def lc_additional(arg=nil)
|
89
|
-
if arg != nil
|
90
|
-
@lc_additional = arg
|
91
|
-
else
|
92
|
-
@lc_additional
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def lc_when(arg=nil)
|
97
|
-
if arg != nil
|
98
|
-
@lc_when = arg
|
99
|
-
else
|
100
|
-
@lc_when
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def created_at(arg=nil)
|
105
|
-
if arg != nil
|
106
|
-
@created_at = arg
|
107
|
-
else
|
108
|
-
@created_at
|
109
|
-
end
|
110
|
-
end
|
111
|
-
def some_msg(arg=nil)
|
112
|
-
if arg != nil
|
113
|
-
@some_msg = arg
|
114
|
-
else
|
115
|
-
@some_msg
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def error?
|
120
|
-
crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
|
121
|
-
end
|
122
|
-
|
123
|
-
# Transform the ruby obj -> to a Hash
|
124
|
-
def to_hash
|
125
|
-
index_hash = Hash.new
|
126
|
-
index_hash["json_claz"] = self.class.name
|
127
|
-
index_hash["id"] = id
|
128
|
-
index_hash["req_type"] = req_type
|
129
|
-
index_hash["appdefns_id"] = appdefns_id
|
130
|
-
index_hash["node_name"] = node_name
|
131
|
-
index_hash["lc_apply"] = lc_apply
|
132
|
-
index_hash["lc_additional"] = lc_additional
|
133
|
-
index_hash["lc_when"] = lc_when
|
134
|
-
index_hash["created_at"] = created_at
|
135
|
-
index_hash["some_msg"] = some_msg
|
136
|
-
index_hash
|
137
|
-
end
|
138
|
-
|
139
|
-
# Serialize this object as a hash: called from JsonCompat.
|
140
|
-
# Verify if this called from JsonCompat during testing.
|
141
|
-
def to_json(*a)
|
142
|
-
for_json.to_json(*a)
|
143
|
-
end
|
144
|
-
|
145
|
-
def for_json
|
146
|
-
result = {
|
147
|
-
"id" => id,
|
148
|
-
"req_type" => req_type,
|
149
|
-
"appdefns_id" => appdefns_id,
|
150
|
-
"node_name" => node_name,
|
151
|
-
"lc_apply" => lc_apply,
|
152
|
-
"lc_additional" => lc_additional,
|
153
|
-
"lc_when" => lc_when,
|
154
|
-
"created_at" => created_at
|
155
|
-
}
|
156
|
-
result
|
157
|
-
end
|
158
|
-
|
159
|
-
|
160
|
-
# Create a Megam::Node from NodeResult-JSON
|
161
|
-
#
|
162
|
-
#[{
|
163
|
-
#"id":"NOD362212018897289216",
|
164
|
-
#"accounts_id":"ACT362211962353876992",
|
165
|
-
#"json_claz":"Megam::Node",
|
166
|
-
#"request":{
|
167
|
-
#"req_id":"NOD362212018897289216",
|
168
|
-
#"command":"commands"
|
169
|
-
#},
|
170
|
-
#"predefs":{
|
171
|
-
#"name":"",
|
172
|
-
#"scm":"",
|
173
|
-
#"war":"",
|
174
|
-
#"db":"",
|
175
|
-
#"queue":""
|
176
|
-
#}
|
177
|
-
#}]
|
178
|
-
#
|
179
|
-
def self.json_create(o)
|
180
|
-
appreq = new
|
181
|
-
appreq.id(o["id"]) if o.has_key?("id")
|
182
|
-
appreq.req_type(o["req_type"]) if o.has_key?("req_type")
|
183
|
-
appreq.appdefns_id(o["appdefns_id"]) if o.has_key?("appdefns_id")
|
184
|
-
appreq.node_name(o["node_name"]) if o.has_key?("node_name")
|
185
|
-
appreq.lc_apply(o["lc_apply"]) if o.has_key?("lc_apply")
|
186
|
-
appreq.lc_additional(o["lc_additional"]) if o.has_key?("lc_additional")
|
187
|
-
appreq.lc_when(o["lc_when"]) if o.has_key?("lc_when")
|
188
|
-
appreq.created_at(o["created_at"]) if o.has_key?("created_at")
|
189
|
-
|
190
|
-
appreq.some_msg[:code] = o["code"] if o.has_key?("code")
|
191
|
-
appreq.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
192
|
-
appreq.some_msg[:msg]= o["msg"] if o.has_key?("msg")
|
193
|
-
appreq.some_msg[:links] = o["links"] if o.has_key?("links")
|
194
|
-
|
195
|
-
appreq
|
196
|
-
end
|
197
|
-
|
198
|
-
def self.from_hash(o)
|
199
|
-
appreq = self.new()
|
200
|
-
appreq.from_hash(o)
|
201
|
-
appreq
|
202
|
-
end
|
203
|
-
|
204
|
-
def from_hash(o)
|
205
|
-
@id = o["id"] if o.has_key?("id")
|
206
|
-
@req_type = o["req_type"] if o.has_key?("req_type")
|
207
|
-
@appdefns_id = o["appdefns_id"] if o.has_key?("appdefns_id")
|
208
|
-
@node_name = o["node_name"] if o.has_key?("node_name")
|
209
|
-
@lc_apply = o["lc_apply"] if o.has_key?("lc_apply")
|
210
|
-
@lc_additional = o["lc_additional"] if o.has_key?("lc_additional")
|
211
|
-
@lc_when = o["lc_when"] if o.has_key?("lc_when")
|
212
|
-
@created_at = o["created_at"] if o.has_key?("created_at")
|
213
|
-
self
|
214
|
-
end
|
215
|
-
|
216
|
-
def self.create(o)
|
217
|
-
acct = from_hash(o)
|
218
|
-
acct.create
|
219
|
-
end
|
220
|
-
|
221
|
-
# Create the node via the REST API
|
222
|
-
def create
|
223
|
-
podnix_rest.post_appreq(to_hash)
|
224
|
-
end
|
225
|
-
|
226
|
-
# Load a account by email_p
|
227
|
-
def self.list(node_name)
|
228
|
-
appreq = self.new()
|
229
|
-
appreq.podnix_rest.get_appreq(node_name)
|
230
|
-
#self
|
231
|
-
end
|
232
|
-
|
233
|
-
def to_s
|
234
|
-
Podnix::Stuff.styled_hash(to_hash)
|
235
|
-
#"---> Megam::Account:[error=#{error?}]\n"+
|
236
|
-
end
|
237
|
-
|
238
|
-
end
|
239
|
-
end
|