keepify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +53 -0
- data/LICENSE.txt +20 -0
- data/README.md +26 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/keepify.gemspec +56 -0
- data/lib/keepify.rb +36 -0
- data/test/helper.rb +18 -0
- data/test/test_keepify.rb +7 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e42f7771d338ddcb9d9f6e2bbbf3050a08a824a
|
4
|
+
data.tar.gz: 5510af2c055fb7adcef8f383406b16f54539e0c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 07d7ed305a260ea2d67f2580e4a2de2c0f46d490bcfeea611ba4f342d9a29c88e8c2e301fe13cb7323bf87fce9d247749ef8fdc6807fbed6ac81a9dffa512a71
|
7
|
+
data.tar.gz: 7d34fb3441c5881dc455ccfe64cdf5312c6ab7f61666871d158399764831531ba1e32e7d888cfc7df39066b49f5d0890a36c5d7a30b9064530a2467af17b424a
|
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rdoc", "~> 3.12"
|
10
|
+
gem "bundler", "~> 1.0"
|
11
|
+
gem "jeweler", "~> 1.8.7"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.5)
|
5
|
+
builder (3.2.2)
|
6
|
+
faraday (0.8.8)
|
7
|
+
multipart-post (~> 1.2.0)
|
8
|
+
git (1.2.6)
|
9
|
+
github_api (0.10.1)
|
10
|
+
addressable
|
11
|
+
faraday (~> 0.8.1)
|
12
|
+
hashie (>= 1.2)
|
13
|
+
multi_json (~> 1.4)
|
14
|
+
nokogiri (~> 1.5.2)
|
15
|
+
oauth2
|
16
|
+
hashie (2.0.5)
|
17
|
+
highline (1.6.20)
|
18
|
+
httpauth (0.2.0)
|
19
|
+
jeweler (1.8.8)
|
20
|
+
builder
|
21
|
+
bundler (~> 1.0)
|
22
|
+
git (>= 1.2.5)
|
23
|
+
github_api (= 0.10.1)
|
24
|
+
highline (>= 1.6.15)
|
25
|
+
nokogiri (= 1.5.10)
|
26
|
+
rake
|
27
|
+
rdoc
|
28
|
+
json (1.8.1)
|
29
|
+
jwt (0.1.8)
|
30
|
+
multi_json (>= 1.5)
|
31
|
+
multi_json (1.8.2)
|
32
|
+
multi_xml (0.5.5)
|
33
|
+
multipart-post (1.2.0)
|
34
|
+
nokogiri (1.5.10)
|
35
|
+
oauth2 (0.9.2)
|
36
|
+
faraday (~> 0.8)
|
37
|
+
httpauth (~> 0.2)
|
38
|
+
jwt (~> 0.1.4)
|
39
|
+
multi_json (~> 1.0)
|
40
|
+
multi_xml (~> 0.5)
|
41
|
+
rack (~> 1.2)
|
42
|
+
rack (1.5.2)
|
43
|
+
rake (10.1.0)
|
44
|
+
rdoc (3.12.2)
|
45
|
+
json (~> 1.4)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
ruby
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
bundler (~> 1.0)
|
52
|
+
jeweler (~> 1.8.7)
|
53
|
+
rdoc (~> 3.12)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 thedecimal
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
## Install
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
gem install keepify
|
5
|
+
```
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
### Initialize Keepify
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
@keepify = Keepify::Tracker.new(YOUR_KEEPIFY_API_TOKEN)
|
13
|
+
```
|
14
|
+
|
15
|
+
### Tracking events
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
@keepify.trackEvent(event_type, user_id, options)
|
19
|
+
```
|
20
|
+
Where **event_type** is a string representing the type of the tracked event, for example : "page_view" or "item_purchase", **user_id** is a unique identifier of the tracked user such as the user's email.
|
21
|
+
and **options** is a hash that accepts the following keys:
|
22
|
+
|
23
|
+
* **kphn** : hostname e.g. "http://mysite.com"
|
24
|
+
* **kppt** : page title e.g. "homepage"
|
25
|
+
* **kpr** : the referral url
|
26
|
+
* **kppr** : the path of the current URL e.g. "/myitems/1"
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "keepify"
|
18
|
+
gem.homepage = "http://github.com/thedecimal/keepify"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Keepify track events with properties directly from your backend}
|
21
|
+
gem.description = %Q{Keepify track events with properties directly from your backend}
|
22
|
+
gem.email = "yaser@rubikal.com"
|
23
|
+
gem.authors = ["thedecimal"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
# require 'rcov/rcovtask'
|
36
|
+
# Rcov::RcovTask.new do |test|
|
37
|
+
# test.libs << 'test'
|
38
|
+
# test.pattern = 'test/**/test_*.rb'
|
39
|
+
# test.verbose = true
|
40
|
+
# test.rcov_opts << '--exclude "gems/*"'
|
41
|
+
# end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rdoc/task'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "keepify #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/keepify.gemspec
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "keepify"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["thedecimal"]
|
12
|
+
s.date = "2013-11-04"
|
13
|
+
s.description = "Keepify track events with properties directly from your backend"
|
14
|
+
s.email = "yaser@rubikal.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"keepify.gemspec",
|
28
|
+
"lib/keepify.rb",
|
29
|
+
"test/helper.rb",
|
30
|
+
"test/test_keepify.rb"
|
31
|
+
]
|
32
|
+
s.homepage = "http://github.com/thedecimal/keepify"
|
33
|
+
s.licenses = ["MIT"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = "2.0.0.rc.2"
|
36
|
+
s.summary = "Keepify track events with properties directly from your backend"
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
s.specification_version = 4
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
43
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
44
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
47
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
48
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
|
49
|
+
end
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
52
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
53
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
data/lib/keepify.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
module Keepify
|
5
|
+
REQUEST_URL = 'http://analytics.keepify.com/kpy.png'
|
6
|
+
MANDATORY_PARAMS = [:kpuid, :kpusr, :kpet]
|
7
|
+
|
8
|
+
class Tracker
|
9
|
+
|
10
|
+
def initialize(client_id)
|
11
|
+
raise "client_id must be supplied" if(client_id.nil? || client_id.empty?)
|
12
|
+
@options = {}
|
13
|
+
@options[:kpusr] = client_id
|
14
|
+
end
|
15
|
+
|
16
|
+
def trackEvent(event_type, user_id, options = {})
|
17
|
+
# merge with static params
|
18
|
+
options.merge!(@options)
|
19
|
+
|
20
|
+
# check for mandatory params
|
21
|
+
if(event_type.nil? || event_type.empty?)
|
22
|
+
raise "event_type should be supplied"
|
23
|
+
elsif (user_id.nil? || user_id.empty?)
|
24
|
+
raise "A user identifier (user email) should be supplied"
|
25
|
+
else
|
26
|
+
options[:kpuid] = user_id
|
27
|
+
options[:kpet] = event_type
|
28
|
+
end
|
29
|
+
|
30
|
+
uri = URI(REQUEST_URL)
|
31
|
+
uri.query = URI.encode_www_form(options)
|
32
|
+
res = Net::HTTP.get_response(uri)
|
33
|
+
puts res.body if res.is_a?(Net::HTTPSuccess)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'keepify'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: keepify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- thedecimal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rdoc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jeweler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.8.7
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.8.7
|
55
|
+
description: Keepify track events with properties directly from your backend
|
56
|
+
email: yaser@rubikal.com
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE.txt
|
61
|
+
- README.md
|
62
|
+
files:
|
63
|
+
- .document
|
64
|
+
- Gemfile
|
65
|
+
- Gemfile.lock
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- VERSION
|
70
|
+
- keepify.gemspec
|
71
|
+
- lib/keepify.rb
|
72
|
+
- test/helper.rb
|
73
|
+
- test/test_keepify.rb
|
74
|
+
homepage: http://github.com/thedecimal/keepify
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.0.0.rc.2
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Keepify track events with properties directly from your backend
|
98
|
+
test_files: []
|