lib/pushbullet/client.rb in pushbullet_client-0.0.4 vs lib/pushbullet/client.rb in pushbullet_client-0.0.5

- old
+ new

@@ -21,14 +21,15 @@ # TODO: Date parsing # TODO: Create api client creation library attr_reader :key, :secret, :base_path, :port - def initialize(access_token:, base_path: API_V2_BASE_PATH, port: 80) + def initialize(access_token:, base_path: API_V2_BASE_PATH, port: 80, limit: 500) @access_token = access_token @base_path = base_path @port = port + @limit = limit end def self.compatible_api_version 'v2' end @@ -41,10 +42,12 @@ private def authorise_and_send(http_method:, path:, payload: {}, params: {}) start_time = micro_second_time_now + params['limit'] = @limit + response = HTTParty.send( http_method.to_sym, construct_base_path(path, params), body: payload, headers: { @@ -102,10 +105,10 @@ end def construct_base_path(path, params) constructed_path = "#{base_path}/#{path}" - if params != {} + if params == {} constructed_path else "#{constructed_path}?#{process_params(params)}" end end