Class: Megam::CloudToolSetting
- Defined in:
- lib/megam/core/cloudtoolsetting.rb
Instance Attribute Summary
Attributes inherited from ServerAPI
Class Method Summary collapse
- .create(o, tmp_email = nil, tmp_api_key = nil) ⇒ Object
- .from_hash(o, tmp_email = nil, tmp_api_key = nil) ⇒ Object
- .json_create(o) ⇒ Object
-
.list(tmp_email = nil, tmp_api_key = nil) ⇒ Object
Load all cloudtoolsettings - returns a cloudtoolsettingsCollection don’t return self.
-
.show(p_name, tmp_email = nil, tmp_api_key = nil) ⇒ Object
Show a particular cloudtoolsetting by name, Megam::cloudtoolsetting.
Instance Method Summary collapse
- #accounts_id(arg = nil) ⇒ Object
- #cloud_tool_setting ⇒ Object
- #cloud_type(arg = nil) ⇒ Object
- #conf_location(arg = nil) ⇒ Object
-
#create ⇒ Object
Create the cloudtoolsetting via the REST API.
- #created_at(arg = nil) ⇒ Object
- #error? ⇒ Boolean
- #for_json ⇒ Object
- #from_hash(o) ⇒ Object
- #id(arg = nil) ⇒ Object
-
#initialize(email = nil, api_key = nil) ⇒ CloudToolSetting
constructor
A new instance of CloudToolSetting.
- #repo(arg = nil) ⇒ Object
- #repo_name(arg = nil) ⇒ Object
- #some_msg(arg = nil) ⇒ Object
-
#to_hash ⇒ Object
Transform the ruby obj -> to a Hash.
-
#to_json(*a) ⇒ Object
Serialize this object as a hash: called from JsonCompat.
- #to_s ⇒ Object
- #vault_location(arg = nil) ⇒ Object
Methods inherited from ServerAPI
Constructor Details
#initialize(email = nil, api_key = nil) ⇒ CloudToolSetting
Returns a new instance of CloudToolSetting.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 19 def initialize(email=nil, api_key=nil) @id = nil @accounts_id = nil @cloud_type = nil @repo_name = nil @repo = nil @vault_location=nil @conf_location=nil @created_at = nil @some_msg = {} super(email, api_key) end |
Class Method Details
.create(o, tmp_email = nil, tmp_api_key = nil) ⇒ Object
187 188 189 190 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 187 def self.create(o,tmp_email=nil, tmp_api_key=nil) acct = from_hash(o,tmp_email, tmp_api_key) acct.create end |
.from_hash(o, tmp_email = nil, tmp_api_key = nil) ⇒ Object
169 170 171 172 173 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 169 def self.from_hash(o,tmp_email=nil, tmp_api_key=nil) cts = self.new(tmp_email,tmp_api_key) cts.from_hash(o) cts end |
.json_create(o) ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 150 def self.json_create(o) cts = new cts.id(o["id"]) if o.has_key?("id") cts.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id") cts.cloud_type(o["cloud_type"]) if o.has_key?("cloud_type") cts.repo_name(o["repo_name"]) if o.has_key?("repo_name") cts.repo(o["repo"]) if o.has_key?("repo") cts.vault_location(o["vault_location"]) if o.has_key?("vault_location") cts.conf_location(o["conf_location"]) if o.has_key?("conf_location") cts.created_at(o["created_at"]) if o.has_key?("created_at") #success or error cts.some_msg[:code] = o["code"] if o.has_key?("code") cts.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type") cts.some_msg[:msg]= o["msg"] if o.has_key?("msg") cts.some_msg[:links] = o["links"] if o.has_key?("links") cts end |
.list(tmp_email = nil, tmp_api_key = nil) ⇒ Object
Load all cloudtoolsettings - returns a cloudtoolsettingsCollection don’t return self. check if the Megam::cloudtoolsettingCollection is returned.
200 201 202 203 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 200 def self.list(tmp_email=nil, tmp_api_key=nil) cts = self.new(tmp_email, tmp_api_key) cts.megam_rest.get_cloudtoolsettings end |
.show(p_name, tmp_email = nil, tmp_api_key = nil) ⇒ Object
Show a particular cloudtoolsetting by name, Megam::cloudtoolsetting
207 208 209 210 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 207 def self.show(p_name,tmp_email=nil, tmp_api_key=nil) pre = self.new(tmp_email, tmp_api_key) pre.megam_rest.get_cloudtoolsetting(p_name) end |
Instance Method Details
#accounts_id(arg = nil) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 45 def accounts_id(arg=nil) if arg != nil @accounts_id= arg else @accounts_id end end |
#cloud_tool_setting ⇒ Object
32 33 34 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 32 def cloud_tool_setting self end |
#cloud_type(arg = nil) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 53 def cloud_type(arg=nil) if arg != nil @cloud_type = arg else @cloud_type end end |
#conf_location(arg = nil) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 85 def conf_location(arg=nil) if arg != nil @conf_location= arg else @conf_location end end |
#create ⇒ Object
Create the cloudtoolsetting via the REST API
193 194 195 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 193 def create megam_rest.post_cloudtoolsetting(to_hash) end |
#created_at(arg = nil) ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 93 def created_at(arg=nil) if arg != nil @created_at = arg else @created_at end end |
#error? ⇒ Boolean
109 110 111 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 109 def error? crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error") end |
#for_json ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 135 def for_json result = { "id" => id, "accounts_id" => accounts_id, "cloud_type" => cloud_type, "repo" => repo, "repo_name" => repo_name, "vault_location" => vault_location, "conf_location" => conf_location, "created_at" => created_at } result end |
#from_hash(o) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 175 def from_hash(o) @id = o[:id] if o.has_key?(:id) @accounts_id = o[:accounts_id] if o.has_key?(:accounts_id) @cloud_type = o[:cloud_type] if o.has_key?(:cloud_type) @repo_name = o[:repo_name] if o.has_key?(:repo_name) @repo = o[:repo] if o.has_key?(:repo) @vault_location = o[:vault_location] if o.has_key?(:vault_location) @conf_location = o[:conf_location] if o.has_key?(:conf_location) @created_at = o[:created_at] if o.has_key?(:created_at) self end |
#id(arg = nil) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 37 def id(arg=nil) if arg != nil @id = arg else @id end end |
#repo(arg = nil) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 69 def repo(arg=nil) if arg != nil @repo = arg else @repo end end |
#repo_name(arg = nil) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 61 def repo_name(arg=nil) if arg != nil @repo_name = arg else @repo_name end end |
#some_msg(arg = nil) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 101 def some_msg(arg=nil) if arg != nil @some_msg = arg else @some_msg end end |
#to_hash ⇒ Object
Transform the ruby obj -> to a Hash
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 114 def to_hash index_hash = Hash.new index_hash["json_claz"] = self.class.name index_hash["id"] = id index_hash["accounts_id"] = accounts_id index_hash["cloud_type"] = cloud_type index_hash["repo_name"] = repo_name index_hash["repo"] = repo index_hash["vault_location"] = vault_location index_hash["conf_location"] = conf_location index_hash["created_at"] = created_at index_hash["some_msg"] = some_msg index_hash end |
#to_json(*a) ⇒ Object
Serialize this object as a hash: called from JsonCompat. Verify if this called from JsonCompat during testing.
131 132 133 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 131 def to_json(*a) for_json.to_json(*a) end |
#to_s ⇒ Object
212 213 214 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 212 def to_s Megam::Stuff.styled_hash(to_hash) end |
#vault_location(arg = nil) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/megam/core/cloudtoolsetting.rb', line 77 def vault_location(arg=nil) if arg != nil @vault_location= arg else @vault_location end end |