harvesting icon indicating copy to clipboard operation
harvesting copied to clipboard

Improve documentation

Open etagwerker opened this issue 6 years ago • 7 comments

I realize that examples in the README.md are not the best way to document the behavior of this gem.

It would be great if we could point people to this page so that they could see complete documentation of the librtary: https://www.rubydoc.info/github/ombulabs/harvesting/Harvesting/Client#clients-instance_method

etagwerker avatar Nov 03 '18 18:11 etagwerker

~~How do you create a single time entry using Harvesting?~~

This was the closest I could get, since I didn't want to use an ENV variable for the access_token:

class HarvestService < ApplicationService
  def initialize(access_token:,account_id:)
    @client = Harvesting::Client.new(access_token: access_token, account_id: account_id)
  end

  def take_day_off(date:)
    entry = Harvesting::Models::TimeEntry.new(
      {
        # user_id: defaults to access token user
        project_id: project.id,
        task_id: task.id,
        spent_date: date,
        started_time: "9:00am",
        ended_time: "5:00pm",
      },
      client: @client
    )
    @client.create(entry)
  end

  protected
    def project(name: )
      @client.projects.entries.first
    end

    def task(name: )
      @client.tasks.entries.first
    end
end

that extra client: option was quite confusing. I'm excited about your TODO.md!

toobulkeh avatar Feb 16 '19 16:02 toobulkeh

@etagwerker @bronzdoc is this issue already done? Looks like there is already a link to the documentation.

cleicar avatar Oct 25 '19 17:10 cleicar

@cleicar where's the link to the documentation?

bronzdoc avatar Oct 30 '19 14:10 bronzdoc

@bronzdoc @cleicar here it is: https://rubydoc.info/github/fastruby/harvesting

etagwerker avatar Oct 30 '19 15:10 etagwerker

I find the proposed addition very valuable. Was also exactly the information I was searching for (ended up reading the code, not the documentation).

fwolfst avatar Jan 31 '22 14:01 fwolfst

Would you accept a PR with that change (in the readme)?

fwolfst avatar Jan 31 '22 14:01 fwolfst

@fwolfst Sure thing. Go for it. 👍

etagwerker avatar Jan 31 '22 14:01 etagwerker