Class: Harvest::API::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/harvest/api/account.rb

Overview

API Methods to contain all account actions

Instance Attribute Summary

Attributes inherited from Base

#credentials

Instance Method Summary collapse

Methods inherited from Base

api_model, #initialize

Constructor Details

This class inherits a constructor from Harvest::API::Base

Instance Method Details

#rate_limit_statusHarvest::RateLimitStatus

Returns the current rate limit information


9
10
11
12
# File 'lib/harvest/api/account.rb', line 9

def rate_limit_status
  response = request(:get, credentials, '/account/rate_limit_status')
  Harvest::RateLimitStatus.parse(response.body).first
end

#who_am_iHarvest::User

Returns the current logged in user

Returns:


16
17
18
19
20
21
22
# File 'lib/harvest/api/account.rb', line 16

def who_am_i
  response = request(:get, credentials, '/account/who_am_i')
  parsed = JSON.parse(response.body)
  Harvest::User.parse(parsed).first.tap do |user|
    user.company = parsed["company"]
  end
end