lib/Breinify.rb in Breinify-0.1.4 vs lib/Breinify.rb in Breinify-0.1.5

- old
+ new

@@ -8,13 +8,13 @@ module Breinify ## # LOGGING # logger - $log = Logger.new(STDOUT) - ## $log = Logger.new('breinify.log', 'daily') - $log.sev_threshold = Logger::DEBUG + ##$log = Logger.new(STDOUT) + $log = Logger.new('breinify.log', 'daily') + $log.sev_threshold = Logger::ERROR ## # == Description # Provides the configuration of the library for the properties supplied. # @@ -130,26 +130,26 @@ # class BreinActivity attr_accessor :http, :request, - :initDone + :init_done ## # Create an instance of BreinConfig # def initialize @brein_config = BreinConfig.instance - @initDone = false + @init_done = false end ## # Initializes the HTTP context def init_rest # if the initialization has already been done then go back - if @initDone + if @init_done return end # url to use with activity endpoint full_url = @brein_config.url + @brein_config.activity_endpoint @@ -164,11 +164,11 @@ # request itself @request = Net::HTTP::Post.new(uri.request_uri, {'accept': 'application/json'}) # indicates that the initializing for HTTP instance variables has been done - @initDone = true + @init_done = true end ## # Singleton Pattern @@instance = BreinActivity.new @@ -239,14 +239,14 @@ category_data['category'] = default_category end # prepare the body and send the request init_rest - request.body = data.to_json - $log.debug 'JSON data request is: ' + data.to_json.to_s + @request.body = data.to_json + $log.debug 'JSON data request is: ' + @request.body.to_json.to_s # Send the request - response = http.request(request) + response = http.request(@request) $log.debug 'response from call is: ' + response.to_s rescue Exception => e $log.debug 'Exception caught: ' + e.message $log.debug ' Backtrace is: ' + e.backtrace.inspect