Class: Megam::Rawimages
Instance Attribute Summary
Attributes inherited from RestAdapter
#api_key, #email, #headers, #host, #master_key, #password_hash
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from RestAdapter
#megam_rest
Constructor Details
Returns a new instance of Rawimages.
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/megam/core/rawimages.rb', line 3
def initialize(o)
@id = nil
@account_id = nil
@name = nil
@repos = nil
@status = nil
@inputs = []
@created_at = nil
@updated_at = nil
@org_id = nil
super(o)
end
|
Class Method Details
.create(params) ⇒ Object
179
180
181
182
|
# File 'lib/megam/core/rawimages.rb', line 179
def self.create(params)
quo = from_hash(params)
quo.create
end
|
.from_hash(o) ⇒ Object
148
149
150
151
152
|
# File 'lib/megam/core/rawimages.rb', line 148
def self.from_hash(o)
quo = new(o)
quo.from_hash(o)
quo
end
|
.json_create(o) ⇒ Object
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/megam/core/rawimages.rb', line 134
def self.json_create(o)
quo = new({})
quo.id(o['id']) if o.key?('id')
quo.org_id(o['org_id']) if o.key?('org_id')
quo.account_id(o["account_id"]) if o.has_key?("account_id")
quo.name(o['name']) if o.key?('name')
quo.repos(o['repos']) if o.key?('repos')
quo.inputs(o['inputs']) if o.key?('inputs')
quo.status(o['status']) if o.key?('status')
quo.created_at(o['created_at']) if o.key?('created_at')
quo.updated_at(o['updated_at']) if o.key?('updated_at')
quo
end
|
.list(params) ⇒ Object
174
175
176
177
|
# File 'lib/megam/core/rawimages.rb', line 174
def self.list(params)
quo = self.new(params)
quo.megam_rest.list_rawimages
end
|
.show(params) ⇒ Object
169
170
171
172
|
# File 'lib/megam/core/rawimages.rb', line 169
def self.show(params)
quo = new(params)
quo.megam_rest.get_one_rawimage(params['id'])
end
|
Instance Method Details
#account_id(arg = nil) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/megam/core/rawimages.rb', line 36
def account_id(arg=nil)
if arg != nil
@account_id = arg
else
@account_id
end
end
|
#create ⇒ Object
184
185
186
|
# File 'lib/megam/core/rawimages.rb', line 184
def create
megam_rest.post_rawimages(to_hash)
end
|
#created_at(arg = nil) ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/megam/core/rawimages.rb', line 68
def created_at(arg = nil)
if !arg.nil?
@created_at = arg
else
@created_at
end
end
|
#error? ⇒ Boolean
92
93
94
|
# File 'lib/megam/core/rawimages.rb', line 92
def error?
crocked = true if some_msg.key?(:msg_type) && some_msg[:msg_type] == 'error'
end
|
#for_json ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# File 'lib/megam/core/rawimages.rb', line 118
def for_json
result = {
'id' => id,
'account_id' => account_id,
'name' => name,
'org_id' => org_id,
'repos' => repos,
'inputs' => inputs,
'status' => status,
'created_at' => created_at,
'updated_at' => updated_at
}
result
end
|
#from_hash(o) ⇒ Object
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/megam/core/rawimages.rb', line 154
def from_hash(o)
@id = o['id'] if o.key?('id')
@org_id = o['org_id'] if o.key?('org_id')
@account_id = o["account_id"] if o.has_key?("account_id")
@name = o['name'] if o.key?('name')
@region = o['region'] if o.key?('region')
@repos = o['repos'] if o.key?('repos')
@inputs = o['inputs'] if o.key?('inputs')
@status = o['status'] if o.key?('status')
@created_at = o['created_at'] if o.key?('created_at')
@updated_at = o['updated_at'] if o.key?('updated_at')
self
end
|
#id(arg = nil) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/megam/core/rawimages.rb', line 20
def id(arg = nil)
if !arg.nil?
@id = arg
else
@id
end
end
|
52
53
54
55
56
57
58
|
# File 'lib/megam/core/rawimages.rb', line 52
def inputs(arg = [])
if arg != []
@inputs = arg
else
@inputs
end
end
|
#name(arg = nil) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/megam/core/rawimages.rb', line 28
def name(arg = nil)
if !arg.nil?
@name = arg
else
@name
end
end
|
#org_id(arg = nil) ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/megam/core/rawimages.rb', line 84
def org_id(arg = nil)
if !arg.nil?
@org_id = arg
else
@org_id
end
end
|
#rawimages ⇒ Object
16
17
18
|
# File 'lib/megam/core/rawimages.rb', line 16
def rawimages
self
end
|
#repos(arg = nil) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/megam/core/rawimages.rb', line 44
def repos(arg = nil)
if !arg.nil?
@repos = arg
else
@repos
end
end
|
#status(arg = nil) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/megam/core/rawimages.rb', line 60
def status(arg = nil)
if !arg.nil?
@status = arg
else
@status
end
end
|
#to_hash ⇒ Object
Transform the ruby obj -> to a Hash
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/megam/core/rawimages.rb', line 97
def to_hash
index_hash = {}
index_hash['json_claz'] = self.class.name
index_hash['id'] = id
index_hash['org_id'] = org_id
index_hash["account_id"] = account_id
index_hash['name'] = name
index_hash['repos'] = repos
index_hash['status'] = status
index_hash['inputs'] = inputs
index_hash['created_at'] = created_at
index_hash['updated_at'] = updated_at
index_hash
end
|
#to_json(*a) ⇒ Object
Serialize this object as a hash: called from JsonCompat. Verify if this called from JsonCompat during testing.
114
115
116
|
# File 'lib/megam/core/rawimages.rb', line 114
def to_json(*a)
for_json.to_json(*a)
end
|
#to_s ⇒ Object
Create the node via the REST API
190
191
192
|
# File 'lib/megam/core/rawimages.rb', line 190
def to_s
Megam::Stuff.styled_hash(to_hash)
end
|
#updated_at(arg = nil) ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/megam/core/rawimages.rb', line 76
def updated_at(arg = nil)
if !arg.nil?
@updated_at = arg
else
@updated_at
end
end
|