lib/harvesting/client.rb in harvesting-0.5.1 vs lib/harvesting/client.rb in harvesting-0.6.0

- old
+ new

@@ -10,11 +10,11 @@ attr_accessor :access_token, :account_id # Returns a new instance of `Client` # - # client = Client.new(access_token: "12345678", account_id: "98764") + # client = Client.new({ access_token: "12345678", account_id: "98764" }) # # @param [Hash] opts the options to create an API client # @option opts [String] :access_token Harvest access token # @option opts [String] :account_id Harvest account id def initialize(access_token: ENV['HARVEST_ACCESS_TOKEN'], account_id: ENV['HARVEST_ACCOUNT_ID']) @@ -28,11 +28,11 @@ # @return [Harvesting::Models::User] def me Harvesting::Models::User.new(get("users/me"), harvest_client: self) end - + # @return [Harvesting::Models::Clients] def clients(opts = {}) Harvesting::Models::Clients.new(get("clients", opts), opts, harvest_client: self) end @@ -114,10 +114,10 @@ def delete(entity) url = "#{DEFAULT_HOST}/#{entity.path}" uri = URI(url) response = http_response(:delete, uri) raise UnprocessableRequest.new(response.to_s) unless response.code.to_i == 200 - + JSON.parse(response.body) end # Performs a GET request and returned the parsed JSON as a Hash. #