remetric 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a36a8a91d9ed254109e9af6e3918190ff8a04cfd
4
+ data.tar.gz: ade7d2d06d0e8dea6f5b530e9741d215c4b9ebec
5
+ SHA512:
6
+ metadata.gz: c7f7bc78380d673216abd44bc1ca636df503c3e157807f1124c6b66bfd4864a867b0635fbfa4def1a631585f29178baf2a8fc31221fea79ca3dcbb73ec0787e6
7
+ data.tar.gz: 640930a770834cb2f0ffce21a1d59c063e08fe2dd1405f21404a7c3434241eef745a00342c16465af1970f09ac06e0748944e50d72e87f6900fdebc77ca9fe13
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in remetric.gemspec
4
+ gemspec
5
+
6
+ gem 'rest-client'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dallas Read
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ # Remetric
2
+
3
+ Remetric tracks your user data in a snap!
4
+
5
+ This gem interacts with our API.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'remetric'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install remetric
20
+
21
+ ## Usage
22
+
23
+ `Key` is always required!
24
+
25
+ ```
26
+ r = Remetric.new "#{remetric_api_token}"
27
+
28
+ r.track "{{ name }} signed in with {{ email }}.", {
29
+ key: user.id,
30
+ email: user.email,
31
+ name: user.name,
32
+ last_sign_in: Time.now.to_i,
33
+ comments: user.comments.count
34
+ }
35
+
36
+ r.save_contact({
37
+ key: user.id,
38
+ email: user.email,
39
+ name: user.name
40
+ })
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,36 @@
1
+ require "remetric/version"
2
+
3
+ class Remetric
4
+
5
+ def initialize api_key, sandbox = false
6
+ @rm_api_key = api_key
7
+ @rm_sandbox = sandbox
8
+ end
9
+
10
+ def api_key
11
+ @rm_api_key
12
+ end
13
+
14
+ def save_contact data = {}
15
+ RestClient.post "#{endpoint}/contacts/save.json", {
16
+ api_key: api_key,
17
+ contact: {
18
+ data: data
19
+ }
20
+ }
21
+ end
22
+
23
+ def track description, data = {}
24
+ RestClient.post "#{endpoint}/events.json", {
25
+ api_key: api_key,
26
+ event: {
27
+ data: data,
28
+ description: description
29
+ }
30
+ }
31
+ end
32
+
33
+ def endpoint
34
+ @rm_sandbox ? "http://localhost:3000" : "https://secure.remetric.com"
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ class Remetric
2
+ VERSION = "0.0.1"
3
+ end
Binary file
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'remetric/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "remetric"
8
+ spec.version = Remetric::VERSION
9
+ spec.authors = ["Dallas Read"]
10
+ spec.email = ["dallas@excitereative.ca"]
11
+ spec.description = %q{Remetric tracks your user data in a snap!}
12
+ spec.summary = %q{Remetric tracks your user data in a snap!}
13
+ spec.homepage = "http://www.remetric.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: remetric
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dallas Read
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Remetric tracks your user data in a snap!
42
+ email:
43
+ - dallas@excitereative.ca
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - Gemfile
49
+ - LICENSE.txt
50
+ - README.md
51
+ - Rakefile
52
+ - lib/remetric.rb
53
+ - lib/remetric/version.rb
54
+ - remetric-0.0.1.gem
55
+ - remetric.gemspec
56
+ homepage: http://www.remetric.com
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.0.0
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Remetric tracks your user data in a snap!
80
+ test_files: []