mashape-analytics 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e507b18ab91cf466429b73696d8870399718405
4
- data.tar.gz: 84a0ff103e263238b9666266ee15711c98b8b9f6
3
+ metadata.gz: 250f90de0c62a79b8bb236f960e08d2bc8561901
4
+ data.tar.gz: a1cfe8f56a5aad8f5d37d31b92889547e5039acd
5
5
  SHA512:
6
- metadata.gz: bf23a510a58e286407907dbc4c69562503afd900eba40b0a090779759732177e031f6794501756b8c72a003db2ba8721a6513d86ee054ddadc0f1d6c5330fbeb
7
- data.tar.gz: 4c4c68ae3a0e35367ddc06d63d1b7f83cc34d1aaf0bad0920eecefd3e2d25e62b51d1ce9cb4f88a989d2bf19f412c9efb9a57b4b375af9e8b5b65810727c76e6
6
+ metadata.gz: 750577b3c2cc0ffa9ca40e6c7a460bce92482fe120003f0bc40312d4fbbd2411bb8d4c48a658d2d3fcbdddb2ac16ed0e89c0a4fb04dfc5718eddd00eb7edf22d
7
+ data.tar.gz: 84f6dd47a13cdd9d169ac406958ec7bc0363df2a764d7f6b419ee404331d249fc7cc3e50531629000fdfe70998b30ec28a8348a50e4f43ac476b4ac193570cc7
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
3
  - 1.9.3
5
- - 2.0.0
4
+ - 2.0.0
5
+
6
+ sudo: false
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  > for more information on Mashape Analytics, please visit [apianalytics.com](https://www.apianalytics.com)
4
4
 
5
+ ## Requirements
6
+
7
+ - [ZeroMQ](http://zeromq.org/intro:get-the-software)
8
+
9
+
5
10
  ## Installation
6
11
 
7
12
 
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ require 'rake'
14
14
  require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
- gem.name = "apianalytics"
17
+ gem.name = "mashape-analytics"
18
18
  gem.homepage = "http://github.com/Mashape/analytics-agent-ruby"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{Ruby agent for Mashape API Analytics}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -19,9 +19,9 @@ module MashapeAnalytics::Frameworks
19
19
  @service_token = options[:service_token]
20
20
  @environment = options[:environment] || ''
21
21
  @send_body = options[:send_body] || false
22
- host = options[:host] || 'socket.analytics.mashape.com:5500'
22
+ host = options[:host] || 'tcp://socket.analytics.mashape.com:5500'
23
23
 
24
- MashapeAnalytics::Capture.setOptions(host: 'tcp://' + host)
24
+ MashapeAnalytics::Capture.setOptions(host: host)
25
25
  end
26
26
 
27
27
  def call(env)
@@ -102,7 +102,11 @@ module MashapeAnalytics::Frameworks
102
102
  if request['HTTP_CONTENT_LENGTH']
103
103
  request['HTTP_CONTENT_LENGTH'].to_i
104
104
  else
105
- request['rack.input'].size
105
+ if request['rack.input'].respond_to? :size
106
+ request['rack.input'].size
107
+ else
108
+ -1 # Not available
109
+ end
106
110
  end
107
111
  end
108
112
 
@@ -2,18 +2,18 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: mashape-analytics 1.0.0 ruby lib
5
+ # stub: mashape-analytics 1.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "mashape-analytics"
9
- s.version = "1.0.1"
9
+ s.version = "1.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
- s.authors = ["Mashape"]
13
+ s.authors = ["Kenneth Lee"]
14
14
  s.date = "2015-06-25"
15
- s.description = "The ruby agent that reports your API traffic to http://apianalytics.com"
16
- s.email = "opensource@mashape.com"
15
+ s.description = "The ruby agent reports API traffic to http://apianalytics.com"
16
+ s.email = "kennethkl@gmail.com"
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
19
  "README.md"
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
27
27
  "README.md",
28
28
  "Rakefile",
29
29
  "VERSION",
30
- "mashape-analytics.gemspec",
31
30
  "lib/mashape-analytics.rb",
32
31
  "lib/mashape-analytics/capture.rb",
33
32
  "lib/mashape-analytics/frameworks.rb",
@@ -37,6 +36,7 @@ Gem::Specification.new do |s|
37
36
  "lib/mashape-analytics/message.rb",
38
37
  "lib/mashape-analytics/message/alf.rb",
39
38
  "lib/mashape-analytics/utils.rb",
39
+ "mashape-analytics.gemspec",
40
40
  "test/helper.rb",
41
41
  "test/test_capture.rb",
42
42
  "test/test_rack.rb",
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
45
45
  s.homepage = "http://github.com/Mashape/analytics-agent-ruby"
46
46
  s.licenses = ["MIT"]
47
47
  s.rubygems_version = "2.4.6"
48
- s.summary = "Ruby agent for Mashape Analytics"
48
+ s.summary = "Ruby agent for Mashape API Analytics"
49
49
 
50
50
  if s.respond_to? :specification_version then
51
51
  s.specification_version = 4
data/test/helper.rb CHANGED
@@ -39,7 +39,8 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
39
39
  require 'mashape-analytics'
40
40
 
41
41
  class MiniTest::Test
42
- @@host = 'tcp://127.0.0.1:2200'
42
+ @@host = 'tcp://127.0.0.1:' << (56000 + rand(999)).to_s
43
+ puts 'Using test zmq server ' << @@host
43
44
 
44
45
  MashapeAnalytics::Capture.setOptions(host: @@host) # Set default host
45
46
 
data/test/test_capture.rb CHANGED
@@ -10,7 +10,7 @@ class TestCapture < MiniTest::Test
10
10
 
11
11
  def teardown
12
12
  MashapeAnalytics::Capture.disconnect
13
- @zmq_pull.close
13
+ @zmq_pull.close if @zmq_pull != nil
14
14
  end
15
15
 
16
16
  should 'send ALF' do
data/test/test_rack.rb CHANGED
@@ -9,7 +9,7 @@ class TestRack < MiniTest::Test
9
9
  sleep 0.05
10
10
  [200, {'CONTENT-TYPE' => 'application/json'}, ['{"messages": "Test Response"}']]
11
11
  end
12
- stack = MashapeAnalytics::Frameworks::Rack.new app, service_token: 'SERVICE-TOKEN', host: '127.0.0.1:2200', send_body: @send_body
12
+ stack = MashapeAnalytics::Frameworks::Rack.new app, service_token: 'SERVICE-TOKEN', host: @@host, send_body: @send_body
13
13
  Rack::MockRequest.new(stack)
14
14
  end
15
15
 
@@ -20,7 +20,7 @@ class TestRack < MiniTest::Test
20
20
 
21
21
  def teardown
22
22
  MashapeAnalytics::Capture.disconnect
23
- @zmq_pull.close
23
+ @zmq_pull.close if @zmq_pull != nil
24
24
  @send_body = false
25
25
  end
26
26
 
data/test/test_sinatra.rb CHANGED
@@ -11,7 +11,7 @@ class TestSinatra < MiniTest::Test
11
11
  Sinatra.new do
12
12
  register MashapeAnalytics::Frameworks::Sinatra
13
13
 
14
- mashapeAnalytics! 'MY-API-KEY', host: '127.0.0.1:2200', send_body: true
14
+ mashapeAnalytics! 'MY-API-KEY', host: @@host, send_body: true
15
15
 
16
16
  get('/get') { 'GET Endpoint' }
17
17
  post('/post') { 'POST Endpoint' }
@@ -20,7 +20,7 @@ class TestSinatra < MiniTest::Test
20
20
 
21
21
  def setup
22
22
  # Create our socket server
23
- @zmq_pull = zmq_pull_socket('tcp://127.0.0.1:2200')
23
+ @zmq_pull = zmq_pull_socket(@@host)
24
24
  end
25
25
 
26
26
  def teardown
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mashape-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
- - Mashape
7
+ - Kenneth Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -134,8 +134,8 @@ dependencies:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '1.4'
137
- description: The ruby agent that reports your API traffic to http://apianalytics.com
138
- email: opensource@mashape.com
137
+ description: The ruby agent reports API traffic to http://apianalytics.com
138
+ email: kennethkl@gmail.com
139
139
  executables: []
140
140
  extensions: []
141
141
  extra_rdoc_files:
@@ -187,5 +187,5 @@ rubyforge_project:
187
187
  rubygems_version: 2.4.6
188
188
  signing_key:
189
189
  specification_version: 4
190
- summary: Ruby agent for Mashape Analytics
190
+ summary: Ruby agent for Mashape API Analytics
191
191
  test_files: []