class EasybillRestClient::DocumentApi
Public Instance Methods
cancel(document_id)
click to toggle source
# File lib/easybill_rest_client/document_api.rb, line 36 def cancel(document_id) build(api_client.request(:post, "/documents/#{document_id}/cancel")) end
create(entity)
click to toggle source
This works around an issue on Easybill's side, where they throw an exception about an item's `id` being `null`, which only seems to go away if we compact the whole hash.
# File lib/easybill_rest_client/document_api.rb, line 10 def create(entity) attributes = entity.attributes attributes[:items] = entity.items.map { |item| item.attributes.compact } build(api_client.request(:post, "/#{resource_name}", attributes)) end
finish(document_id)
click to toggle source
# File lib/easybill_rest_client/document_api.rb, line 32 def finish(document_id) build(api_client.request(:put, "/#{resource_name}/#{document_id}/done")) end
get_pdf(document_id)
click to toggle source
# File lib/easybill_rest_client/document_api.rb, line 24 def get_pdf(document_id) api_client.request(:get, "/#{resource_name}/#{document_id}/pdf") end
resource_class()
click to toggle source
# File lib/easybill_rest_client/document_api.rb, line 20 def resource_class Document end
resource_name()
click to toggle source
# File lib/easybill_rest_client/document_api.rb, line 16 def resource_name 'documents' end
send_email(document_id, email_params = {})
click to toggle source
# File lib/easybill_rest_client/document_api.rb, line 28 def send_email(document_id, email_params = {}) api_client.request(:post, "/#{resource_name}/#{document_id}/send/email", email_params) end