lessneglect 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lessneglect.gemspec +4 -5
- data/readme.md +115 -0
- metadata +3 -4
- data/README.rdoc +0 -8
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
17
|
gem.name = "lessneglect"
|
18
|
-
gem.homepage = "http://github.com/
|
18
|
+
gem.homepage = "http://github.com/lessneglect/lessneglect-ruby"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = "LessNeglect client API"
|
21
21
|
gem.description = "API library to allow you to connect and submit messages and actions to your LessNeglect project account"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lessneglect.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "lessneglect"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Christopher Gooley"]
|
@@ -13,8 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = "API library to allow you to connect and submit messages and actions to your LessNeglect project account"
|
14
14
|
s.email = "gooley@lessneglect.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt"
|
17
|
-
"README.rdoc"
|
16
|
+
"LICENSE.txt"
|
18
17
|
]
|
19
18
|
s.files = [
|
20
19
|
".document",
|
@@ -23,7 +22,6 @@ Gem::Specification.new do |s|
|
|
23
22
|
"Gemfile",
|
24
23
|
"Gemfile.lock",
|
25
24
|
"LICENSE.txt",
|
26
|
-
"README.rdoc",
|
27
25
|
"Rakefile",
|
28
26
|
"VERSION",
|
29
27
|
"lessneglect.gemspec",
|
@@ -35,10 +33,11 @@ Gem::Specification.new do |s|
|
|
35
33
|
"lib/lessneglect/objects/event.rb",
|
36
34
|
"lib/lessneglect/objects/message.rb",
|
37
35
|
"lib/lessneglect/objects/person.rb",
|
36
|
+
"readme.md",
|
38
37
|
"spec/lessneglect_spec.rb",
|
39
38
|
"spec/spec_helper.rb"
|
40
39
|
]
|
41
|
-
s.homepage = "http://github.com/
|
40
|
+
s.homepage = "http://github.com/lessneglect/lessneglect-ruby"
|
42
41
|
s.licenses = ["MIT"]
|
43
42
|
s.require_paths = ["lib"]
|
44
43
|
s.rubygems_version = "1.8.24"
|
data/readme.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
LessNeglect
|
2
|
+
===
|
3
|
+
Allow your ruby app to easily submit server-side messages and events to LessNeglect.
|
4
|
+
|
5
|
+
Installation
|
6
|
+
---
|
7
|
+
|
8
|
+
In your Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'lessneglect'
|
12
|
+
```
|
13
|
+
|
14
|
+
Usage
|
15
|
+
---
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
person = LessNeglectApi::Person.new({
|
19
|
+
:name => "Christopher Gooley",
|
20
|
+
:email => "gooley@foliohd.com",
|
21
|
+
:external_identifer => "gooley",
|
22
|
+
:properties => {
|
23
|
+
:account_level => "Pro",
|
24
|
+
:is_paying => True,
|
25
|
+
:created_at => 1347060566
|
26
|
+
}
|
27
|
+
})
|
28
|
+
|
29
|
+
event = LessNeglectApi::ActionEvent.new({
|
30
|
+
:name => "upgraded"
|
31
|
+
}.merge(extras))
|
32
|
+
|
33
|
+
api = LessNeglectApi::Client.new({
|
34
|
+
:code => "abcdefg",
|
35
|
+
:secret => "1234asdfasdf1234"
|
36
|
+
})
|
37
|
+
|
38
|
+
api.create_action_event(person, event)
|
39
|
+
```
|
40
|
+
|
41
|
+
Sample Helper Class
|
42
|
+
---
|
43
|
+
|
44
|
+
We suggest you create a simple helper class such as /lib/neglect.rb to convert your User model into a LessNeglect Person and submit the event.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
class Neglect
|
48
|
+
|
49
|
+
def self.api
|
50
|
+
@@api ||= LessNeglectApi::Client.new({
|
51
|
+
:code => "asdfasdf",
|
52
|
+
:secret => "1234asdfasdf1234"
|
53
|
+
})
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.log_event(user, event_name, extras = {})
|
57
|
+
return if user.nil? || user[:impersonating]
|
58
|
+
return if Rails.env == "development"
|
59
|
+
|
60
|
+
begin
|
61
|
+
person = LessNeglectApi::Person.new({
|
62
|
+
:name => user.name,
|
63
|
+
:email => user.email,
|
64
|
+
:external_identifer => user.id,
|
65
|
+
:properties => {
|
66
|
+
:account_level => user.account_level,
|
67
|
+
:is_paying => user.paying?,
|
68
|
+
:created_at => user.created_at.to_i
|
69
|
+
}
|
70
|
+
})
|
71
|
+
|
72
|
+
event = LessNeglectApi::ActionEvent.new({
|
73
|
+
:name => event_name
|
74
|
+
}.merge(extras))
|
75
|
+
|
76
|
+
api.create_action_event(person, event)
|
77
|
+
rescue
|
78
|
+
puts "error logging to LN"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.update_person(user)
|
83
|
+
return if Rails.env == "development"
|
84
|
+
|
85
|
+
begin
|
86
|
+
person = LessNeglectApi::Person.new({
|
87
|
+
:name => user.name,
|
88
|
+
:email => user.email,
|
89
|
+
:external_identifer => user.id,
|
90
|
+
:properties => {
|
91
|
+
:account_level => user.account_level,
|
92
|
+
:is_paying => user.paying?,
|
93
|
+
:created_at => user.created_at.to_i
|
94
|
+
}
|
95
|
+
})
|
96
|
+
|
97
|
+
api.update_person(person)
|
98
|
+
rescue
|
99
|
+
puts "error logging to LN"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
Helper Usage
|
107
|
+
--
|
108
|
+
```ruby
|
109
|
+
Neglect.log_event(user, "uploaded-media")
|
110
|
+
```
|
111
|
+
|
112
|
+
== Copyright
|
113
|
+
|
114
|
+
Copyright (c) 2011-2012 Christopher Gooley. See LICENSE.txt for further details.
|
115
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lessneglect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -98,7 +98,6 @@ executables: []
|
|
98
98
|
extensions: []
|
99
99
|
extra_rdoc_files:
|
100
100
|
- LICENSE.txt
|
101
|
-
- README.rdoc
|
102
101
|
files:
|
103
102
|
- .document
|
104
103
|
- .rspec
|
@@ -106,7 +105,6 @@ files:
|
|
106
105
|
- Gemfile
|
107
106
|
- Gemfile.lock
|
108
107
|
- LICENSE.txt
|
109
|
-
- README.rdoc
|
110
108
|
- Rakefile
|
111
109
|
- VERSION
|
112
110
|
- lessneglect.gemspec
|
@@ -118,9 +116,10 @@ files:
|
|
118
116
|
- lib/lessneglect/objects/event.rb
|
119
117
|
- lib/lessneglect/objects/message.rb
|
120
118
|
- lib/lessneglect/objects/person.rb
|
119
|
+
- readme.md
|
121
120
|
- spec/lessneglect_spec.rb
|
122
121
|
- spec/spec_helper.rb
|
123
|
-
homepage: http://github.com/
|
122
|
+
homepage: http://github.com/lessneglect/lessneglect-ruby
|
124
123
|
licenses:
|
125
124
|
- MIT
|
126
125
|
post_install_message:
|