megam_api 0.56 → 0.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/request.rb +28 -28
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3fd7d366846da786b663c9d5b0c86a49525a7d5
|
4
|
+
data.tar.gz: 1f3965af56356353f385c309315dfd519386cc44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee993cbea92129c1d301732036358d277dadd667c76c6c5b41ae69c3cd8443b190399cd33cfc85f5ddaa7a6e5ca7b94ee77e835916564b8484a19d31909bc6c
|
7
|
+
data.tar.gz: 063a75a31be379b57a25c901054e70d56411d7b6c2843e7603f9664c52e4dca28f1e8d7106dbb3ee257cd5e05e3b3c98562aba3f76364c0a0643cb76e51aff9b
|
data/lib/megam/api/version.rb
CHANGED
data/lib/megam/core/request.rb
CHANGED
@@ -17,9 +17,9 @@ module Megam
|
|
17
17
|
class Request < Megam::ServerAPI
|
18
18
|
def initialize(email=nil, api_key=nil)
|
19
19
|
@id = nil
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
20
|
+
@cat_id = nil
|
21
|
+
@name = nil
|
22
|
+
@cattype = nil
|
23
23
|
@command =nil
|
24
24
|
@some_msg = {}
|
25
25
|
@created_at = nil
|
@@ -39,26 +39,26 @@ module Megam
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def cat_id(arg=nil)
|
43
43
|
if arg != nil
|
44
|
-
@
|
44
|
+
@cat_id = arg
|
45
45
|
else
|
46
|
-
@
|
46
|
+
@cat_id
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def name(arg=nil)
|
51
51
|
if arg != nil
|
52
|
-
@
|
52
|
+
@name = arg
|
53
53
|
else
|
54
|
-
@
|
54
|
+
@name
|
55
55
|
end
|
56
56
|
end
|
57
|
-
def
|
57
|
+
def cattype(arg=nil)
|
58
58
|
if arg != nil
|
59
|
-
@
|
59
|
+
@cattype = arg
|
60
60
|
else
|
61
|
-
@
|
61
|
+
@cattype
|
62
62
|
end
|
63
63
|
end
|
64
64
|
def created_at(arg=nil)
|
@@ -94,9 +94,9 @@ module Megam
|
|
94
94
|
index_hash = Hash.new
|
95
95
|
index_hash["json_claz"] = self.class.name
|
96
96
|
index_hash["id"] = id
|
97
|
-
index_hash["
|
98
|
-
index_hash["
|
99
|
-
index_hash["
|
97
|
+
index_hash["cat_id"] = cat_id
|
98
|
+
index_hash["name"] = name
|
99
|
+
index_hash["cattype"] = cattype
|
100
100
|
index_hash["command"] = command
|
101
101
|
index_hash["created_at"] = created_at
|
102
102
|
index_hash
|
@@ -111,9 +111,9 @@ module Megam
|
|
111
111
|
def for_json
|
112
112
|
result = {
|
113
113
|
"id" => id,
|
114
|
-
"
|
115
|
-
"
|
116
|
-
"
|
114
|
+
"cat_id" => cat_id,
|
115
|
+
"name" => name,
|
116
|
+
"cattype" => cattype,
|
117
117
|
"command" => command,
|
118
118
|
"created_at" => created_at
|
119
119
|
}
|
@@ -124,9 +124,9 @@ module Megam
|
|
124
124
|
def self.json_create(o)
|
125
125
|
node = new
|
126
126
|
node.id(o["id"]) if o.has_key?("id")
|
127
|
-
node.
|
128
|
-
node.
|
129
|
-
node.
|
127
|
+
node.cat_id(o["cat_id"]) if o.has_key?("cat_id")
|
128
|
+
node.name(o["name"]) if o.has_key?("name")
|
129
|
+
node.cattype(o["cattype"]) if o.has_key?("cattype")
|
130
130
|
node.command(o["command"]) if o.has_key?("command")
|
131
131
|
node.created_at(o["created_at"]) if o.has_key?("created_at")
|
132
132
|
#success or error
|
@@ -145,18 +145,18 @@ module Megam
|
|
145
145
|
|
146
146
|
def from_hash(o)
|
147
147
|
@id = o[:id] if o.has_key?(:id)
|
148
|
-
@
|
149
|
-
@
|
150
|
-
@
|
148
|
+
@cat_id = o[:cat_id] if o.has_key?(:cat_id)
|
149
|
+
@name = o[:name] if o.has_key?(:name)
|
150
|
+
@cattype = o[:cattype] if o.has_key?(:cattype)
|
151
151
|
@command = o[:command] if o.has_key?(:command)
|
152
152
|
@created_at = o[:created_at] if o.has_key?(:created_at)
|
153
153
|
self
|
154
154
|
end
|
155
155
|
|
156
156
|
|
157
|
-
def self.create(
|
157
|
+
def self.create(params)
|
158
158
|
puts "Entering megam_api-->"
|
159
|
-
acct = from_hash(
|
159
|
+
acct = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key])
|
160
160
|
acct.create
|
161
161
|
end
|
162
162
|
|
@@ -167,8 +167,8 @@ module Megam
|
|
167
167
|
end
|
168
168
|
|
169
169
|
|
170
|
-
def self.show(
|
171
|
-
prede = self.new(
|
170
|
+
def self.show(params)
|
171
|
+
prede = self.new(params["email"] || params[:email], params["api_key"] || params[:api_key])
|
172
172
|
prede.megam_rest.get_requests
|
173
173
|
end
|
174
174
|
|