netstat24 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/netstat24.rb +23 -24
- metadata +1 -1
data/lib/netstat24.rb
CHANGED
@@ -4,63 +4,62 @@ require 'json'
|
|
4
4
|
|
5
5
|
class Netstat24
|
6
6
|
API_URL = 'http://collector.netstat24.com/api/v2'
|
7
|
+
|
7
8
|
attr_accessor :app_id, :access_token, :vid
|
8
9
|
|
9
10
|
def initialize app_id, access_token, vid
|
10
11
|
@app_id, @access_token, @vid = app_id, access_token, vid
|
11
12
|
end
|
12
13
|
|
13
|
-
def send
|
14
|
+
def send params = {}
|
14
15
|
params[:app_id] = app_id
|
15
16
|
params[:access_token] = access_token
|
16
17
|
params[:vid] = vid
|
17
18
|
|
18
|
-
|
19
|
-
raise ServerError.new self, method, params, response['error'] if response['error']
|
20
|
-
response
|
19
|
+
JSON.parse(Net::HTTP.post_form(URI.parse(API_URL), params).body)
|
21
20
|
end
|
22
21
|
|
23
|
-
def
|
22
|
+
def track_event event
|
24
23
|
event = event.gsub(" ", "")
|
25
|
-
send
|
24
|
+
send method: 'track_event', event: event
|
26
25
|
end
|
27
26
|
|
28
|
-
def
|
27
|
+
def track_value event, value
|
29
28
|
event = event.gsub(" ", "")
|
30
|
-
send
|
29
|
+
send method: 'track_value', event: event, value: value
|
31
30
|
end
|
32
31
|
|
33
|
-
def
|
32
|
+
def track_number event, value
|
34
33
|
event = event.gsub(" ", "")
|
35
|
-
send
|
34
|
+
send method: 'track_number', event: event, value: value
|
36
35
|
end
|
37
36
|
|
38
|
-
def revenue
|
39
|
-
send
|
37
|
+
def revenue value
|
38
|
+
send method: 'revenue', value: value
|
40
39
|
end
|
41
40
|
|
42
|
-
def visit
|
43
|
-
send
|
41
|
+
def visit value = nil
|
42
|
+
send method: 'visit', value: value
|
44
43
|
end
|
45
44
|
|
46
|
-
def install
|
47
|
-
send
|
45
|
+
def install value = nil
|
46
|
+
send method: 'install', value: value
|
48
47
|
end
|
49
48
|
|
50
|
-
def
|
51
|
-
send
|
49
|
+
def user_data age, sex, friends, app_friends, level
|
50
|
+
send method: 'user_data', age: age, gender: sex, nfr: friends, nafr: app_friends, lvl: level
|
52
51
|
end
|
53
52
|
|
54
|
-
def
|
55
|
-
send
|
53
|
+
def ad_click value
|
54
|
+
send method: 'ad_click', value: value
|
56
55
|
end
|
57
56
|
|
58
|
-
def
|
59
|
-
send
|
57
|
+
def invite_sent
|
58
|
+
send method: 'invite_sent'
|
60
59
|
end
|
61
60
|
|
62
|
-
def
|
63
|
-
send
|
61
|
+
def invite_response
|
62
|
+
send method: 'invite_response'
|
64
63
|
end
|
65
64
|
|
66
65
|
end
|