netstat24 0.0.3

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 +35 -0
  2. metadata +45 -0
@@ -0,0 +1,35 @@
1
+ #
2
+ # Api documentation: http://netstat24.com/documentation/podklyuchenie_k_sisteme/collector_api
3
+ #
4
+
5
+ require 'net/http'
6
+ require 'uri'
7
+ require 'json'
8
+
9
+ class Netstat24
10
+ API_URL = 'http://collector.netstat24.com/api/v2'
11
+ attr_accessor :app_id, :access_token, :vid
12
+
13
+ def initialize app_id, access_token, vid
14
+ @app_id, @access_token, @vid = app_id, access_token, vid
15
+ end
16
+
17
+ def send(params = {})
18
+ params[:app_id] = app_id
19
+ params[:access_token] = access_token
20
+ params[:vid] = vid
21
+
22
+ response = JSON.parse(Net::HTTP.post_form(URI.parse(API_URL), params).body)
23
+ raise ServerError.new self, method, params, response['error'] if response['error']
24
+ response
25
+ end
26
+
27
+ def visit
28
+ send({method: 'visit'})
29
+ end
30
+
31
+ def userData(age, sex, friends, app_friends, level)
32
+ send({method: 'user_data', age: age, gender: sex, nfr: friends, nafr: app_friends, lvl: level})
33
+ end
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: netstat24
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Maksim Berjoza
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Netstat24 ruby api
15
+ email: maksim.berjoza@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/netstat24.rb
21
+ homepage: http://rubygems.org/gems/netstat24
22
+ licenses: []
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 1.8.25
42
+ signing_key:
43
+ specification_version: 3
44
+ summary: Netstat24
45
+ test_files: []