add customerio gem and event

This commit is contained in:
carlad 2015-12-03 15:04:50 +01:00
parent a4bce14a73
commit 0ecbd8b237
3 changed files with 20 additions and 1 deletions

View File

@ -33,6 +33,7 @@ gem 'skylight', '~> 0.6.0.beta.1'
gem 'stackprof'
gem 'jemalloc'
gem 'customerio'
group :test do
gem 'rspec', '~> 2.13'

View File

@ -157,6 +157,9 @@ GEM
composite_primary_keys (5.0.14)
activerecord (~> 3.2.0, >= 3.2.9)
connection_pool (2.1.1)
customerio (0.6.1)
httparty (>= 0.5, < 0.12)
multi_json (~> 1.0)
dalli (2.7.2)
data_migrations (0.0.1)
activerecord
@ -187,6 +190,9 @@ GEM
hashr (0.0.22)
hike (1.2.3)
hitimes (1.2.3)
httparty (0.11.0)
multi_json (~> 1.0)
multi_xml (>= 0.5.2)
httpclient (2.7.0.1)
i18n (0.7.0)
ice_nine (0.11.1)
@ -215,6 +221,7 @@ GEM
mocha (0.14.0)
metaclass (~> 0.0.1)
multi_json (1.11.2)
multi_xml (0.5.5)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
net-http-pipeline (1.0.1)
@ -335,6 +342,7 @@ PLATFORMS
DEPENDENCIES
active_model_serializers
bunny (~> 0.8.0)
customerio
dalli
database_cleaner (~> 0.8.0)
factory_girl (~> 2.4.0)

View File

@ -160,8 +160,18 @@ class Travis::Api::App
def check_first_login(user)
return if user.first_logged_in_at
puts "this is the first log in!!"
# send event to customer.io
customerio = Customerio::Client.new(Travis.config.customerio.site_id, Travis.config.customerio.api_key, :json => true)
$customerio.identify(
:id => user.id,
:name => user.name,
:login => user.login,
:email => user.email,
:created_at => user.created_at.to_i,
:github_id => user.github_id,
:education => user.education
)
# user.update_attributes(first_logged_in_at: Time.now)
# #send event to customer.io
end
def serialize_user(user)