codegears 0.0.20.pre → 0.0.21.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cg/api.rb +10 -2
- data/lib/cg/app.rb +10 -0
- data/lib/cg/version.rb +1 -1
- metadata +1 -1
data/lib/cg/api.rb
CHANGED
@@ -10,8 +10,8 @@ module CG
|
|
10
10
|
self.post("#{ROOT_URL}/apps", :body => { :application => { :email => email } })
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.show_app_request(id)
|
14
|
-
self.get("#{ROOT_URL}/apps/#{id}")
|
13
|
+
def self.show_app_request(id, secret_id = nil, secret_token = nil)
|
14
|
+
self.get("#{ROOT_URL}/apps/#{id}?#{self.attach_auth(secret_id, secret_token)}")
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.push_message_request(channel, message)
|
@@ -20,5 +20,13 @@ module CG
|
|
20
20
|
:ext => { :secret_id => CG::APP.secret_id, :secret_token => CG::APP.secret_token } }.to_json
|
21
21
|
Net::HTTP.post_form(URI.parse(PUSHER_URL), :message => message)
|
22
22
|
end
|
23
|
+
|
24
|
+
def self.attach_auth(secret_id, secret_token)
|
25
|
+
if secret_id && secret_token
|
26
|
+
"secret_id=#{secret_id}&secret_token=#{secret_token}"
|
27
|
+
else
|
28
|
+
""
|
29
|
+
end
|
30
|
+
end
|
23
31
|
end
|
24
32
|
end
|
data/lib/cg/app.rb
CHANGED
@@ -11,6 +11,10 @@ module CG
|
|
11
11
|
yield(self.instance)
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.id
|
15
|
+
self.instance.id
|
16
|
+
end
|
17
|
+
|
14
18
|
def self.secret_id
|
15
19
|
self.instance.secret_id
|
16
20
|
end
|
@@ -58,6 +62,12 @@ module CG
|
|
58
62
|
instance.response = CG::API.push_message_request(instance.channel, instance.message)
|
59
63
|
end
|
60
64
|
|
65
|
+
def self.stats
|
66
|
+
instance = self.instance
|
67
|
+
|
68
|
+
CG::API.show_app_request(instance.id, instance.secret_id, instance.secret_token)
|
69
|
+
end
|
70
|
+
|
61
71
|
def channel=(ch)
|
62
72
|
@channel = perform(ch)
|
63
73
|
end
|
data/lib/cg/version.rb
CHANGED