Module: QboApi::Supporting
- Included in:
- QboApi
- Defined in:
- lib/qbo_api/supporting.rb
Instance Method Summary collapse
- #batch(payload) ⇒ Object
- #cdc(entities:, changed_since:) ⇒ Object
- #deliver(entity, entity_id:, email_address: nil) ⇒ Object
- #reports(name:, params: nil) ⇒ Object
Instance Method Details
#batch(payload) ⇒ Object
9 10 11 12 |
# File 'lib/qbo_api/supporting.rb', line 9 def batch(payload) path = "#{realm_id}/batch" request(:post, path: path, payload: payload) end |
#cdc(entities:, changed_since:) ⇒ Object
3 4 5 6 7 |
# File 'lib/qbo_api/supporting.rb', line 3 def cdc(entities:, changed_since:) path = "#{realm_id}/cdc" path = add_params_to_path(path: path, params: { entities: entities, changedSince: cdc_time(changed_since) }) request(:get, path: path) end |
#deliver(entity, entity_id:, email_address: nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/qbo_api/supporting.rb', line 20 def deliver(entity, entity_id:, email_address: nil) valid_entities = %i(invoice estimate purchaseorder creditmemo salesreceipt refundreceipt) unless valid_entities.include?(entity.to_sym) raise ArgumentError, "Invalid entity type '#{entity}'. Must be one of: #{valid_entities.join(', ')}" end path = "#{realm_id}/#{entity}/#{entity_id}/send" unless email_address.nil? params = { minorversion: 63, sendTo: email_address } path = add_params_to_path(path: path, params: params) end headers = { 'Content-Type' => 'application/octet-stream' } request(:post, path: path, headers: headers) end |
#reports(name:, params: nil) ⇒ Object
14 15 16 17 18 |
# File 'lib/qbo_api/supporting.rb', line 14 def reports(name:, params: nil) path = "#{realm_id}/reports/#{name}" path = add_params_to_path(path: path, params: params) if params request(:get, path: path) end |