lessneglect 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lessneglect.gemspec +2 -2
- data/lib/lessneglect.rb +1 -1
- data/readme.md +3 -61
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/lessneglect.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "lessneglect"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
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"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-10-05"
|
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 = [
|
data/lib/lessneglect.rb
CHANGED
data/readme.md
CHANGED
@@ -43,68 +43,10 @@ Sample Helper Class
|
|
43
43
|
|
44
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
45
|
|
46
|
-
|
47
|
-
|
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
|
-
```
|
46
|
+
Here's a sample gist of what the helper could look like:
|
47
|
+
https://gist.github.com/3738364
|
105
48
|
|
106
|
-
|
107
|
-
--
|
49
|
+
then you can make one-line event logs:
|
108
50
|
```ruby
|
109
51
|
Neglect.log_event(@current_user, "uploaded-media")
|
110
52
|
```
|
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.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|