netstat24 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/netstat24.rb +23 -24
  2. metadata +1 -1
@@ -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(params = {})
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
- response = JSON.parse(Net::HTTP.post_form(URI.parse(API_URL), params).body)
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 trackEvent(event)
22
+ def track_event event
24
23
  event = event.gsub(" ", "")
25
- send({method: 'track_event', event: event})
24
+ send method: 'track_event', event: event
26
25
  end
27
26
 
28
- def trackValue(event, value)
27
+ def track_value event, value
29
28
  event = event.gsub(" ", "")
30
- send({method: 'track_value', event: event, value: value})
29
+ send method: 'track_value', event: event, value: value
31
30
  end
32
31
 
33
- def trackNumber(event, value)
32
+ def track_number event, value
34
33
  event = event.gsub(" ", "")
35
- send({method: 'track_number', event: event, value: value})
34
+ send method: 'track_number', event: event, value: value
36
35
  end
37
36
 
38
- def revenue(value)
39
- send({method: 'revenue', value: value})
37
+ def revenue value
38
+ send method: 'revenue', value: value
40
39
  end
41
40
 
42
- def visit(value = nil)
43
- send({method: 'visit', value: value})
41
+ def visit value = nil
42
+ send method: 'visit', value: value
44
43
  end
45
44
 
46
- def install(value = nil)
47
- send({method: 'install', value: value})
45
+ def install value = nil
46
+ send method: 'install', value: value
48
47
  end
49
48
 
50
- def userData(age, sex, friends, app_friends, level)
51
- send({method: 'user_data', age: age, gender: sex, nfr: friends, nafr: app_friends, lvl: level})
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 adClick(value)
55
- send({method: 'ad_click', value: value})
53
+ def ad_click value
54
+ send method: 'ad_click', value: value
56
55
  end
57
56
 
58
- def inviteSent
59
- send({method: 'invite_sent'})
57
+ def invite_sent
58
+ send method: 'invite_sent'
60
59
  end
61
60
 
62
- def inviteResponse
63
- send({method: 'invite_response'})
61
+ def invite_response
62
+ send method: 'invite_response'
64
63
  end
65
64
 
66
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netstat24
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: