Method: Forecasting::Client#create
- Defined in:
- lib/forecasting/client.rb
#create(entity) ⇒ Harvesting::Models::Base
Creates an ‘entity` in your Harvest account.
160 161 162 163 164 165 166 |
# File 'lib/forecasting/client.rb', line 160 def create(entity) url = "#{host}/#{entity.path}" uri = URI(url) response = http_response(:post, uri, body: payload(entity)) entity.attributes = JSON.parse(response.body)[entity.type] entity end |