Class: HarvestClient
- Inherits:
-
Object
- Object
- HarvestClient
- Defined in:
- lib/harvest_overtime/harvest_client.rb
Instance Method Summary collapse
-
#initialize(account_id:, personal_access_token:) ⇒ HarvestClient
constructor
A new instance of HarvestClient.
- #time_entries(start_date, end_date) ⇒ Object
Constructor Details
#initialize(account_id:, personal_access_token:) ⇒ HarvestClient
Returns a new instance of HarvestClient.
7 8 9 10 11 12 |
# File 'lib/harvest_overtime/harvest_client.rb', line 7 def initialize(account_id:, personal_access_token:) @faraday = Faraday.new( url: 'https://api.harvestapp.com/api/v2', headers: { 'Harvest-Account-ID' => account_id, 'Authorization' => "Bearer #{personal_access_token}" } ) end |
Instance Method Details
#time_entries(start_date, end_date) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/harvest_overtime/harvest_client.rb', line 14 def time_entries(start_date, end_date) user_id = retrieve_user_id time_entry_hashes = retrieve_time_entries(user_id, start_date, end_date) build_time_entry_objects(time_entry_hashes) end |