lib/Breinify.rb in Breinify-0.1.2 vs lib/Breinify.rb in Breinify-0.1.3
- old
+ new
@@ -145,13 +145,10 @@
end
## add the userAgent
userAgent = retrieiveUserAgentInformation
- # for test purposes
- userAgent = 'BLABLA'
-
# fetch previous values - if they exists
begin
additionalValues = options.fetch('user', {}).fetch('additional', {})
if additionalValues.empty?
@@ -165,22 +162,22 @@
end
rescue
@@logger.debug 'Could not handle userAgent information'
end
- # url to use with actvitiy endpoint
+ # url to use with actvity endpoint
fullUrl = @@url + @@activityEndpoint
# retrieve all the options
uri = URI(fullUrl)
# Create the HTTP objects
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
request = Net::HTTP::Post.new(uri.request_uri, {'accept': 'application/json'})
request.body = data.to_json
- @@logger.debug 'JSON data is: ' + data.to_json.to_s
+ @@logger.debug 'JSON data request is: ' + data.to_json.to_s
# Send the request
response = http.request(request)
@@logger.debug 'response from call is: ' + response.to_s
@@ -195,10 +192,10 @@
##
# == Description
#
def self.retrieiveUserAgentInformation
begin
- userAgent = request.env['HTTP_USER_AGENT']
+ userAgent = request.user_agent
@@logger.debug 'userAgent is: ' + userAgent
rescue
@@logger.debug 'Sorry, no userAgent can be detected'
userAgent = nil
end