Class: TealiumCollect
- Inherits:
-
Object
- Object
- TealiumCollect
- Defined in:
- lib/tealium_collect.rb
Constant Summary collapse
- LIBRARY_NAME =
"ruby"- LIBRARY_VERSION =
"1.0.3"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.collect(payload) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tealium_collect.rb', line 9 def self.collect(payload) uri = URI.parse("https://collect.tealiumiq.com/event") header = {'Content-type': 'application/json'} https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri, header) payload[:tealium_library_name] = LIBRARY_NAME payload[:tealium_library_version] = LIBRARY_VERSION request.body = payload.to_json response = https.request(request) #uncomment the line below for debugging #checkRequestResponse(response) end |
Instance Method Details
#checkRequestResponse(response) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tealium_collect.rb', line 25 def checkRequestResponse(response) case response when Net::HTTPOK puts "Data sent to Tealium: " + response. else puts "Error sending data: " + response. end end |