Sha256: 07dfd6f5da9858f0a9325308d4ada42825a50f697609639e88f5736caa9a4b18

Contents?: true

Size: 856 Bytes

Versions: 2

Compression:

Stored size: 856 Bytes

Contents

module Octobat
  class CreditNote < APIResource
    extend Octobat::APIOperations::List
    include Octobat::APIOperations::Create
    include Octobat::APIOperations::Update

    def send_by_email(email_data = {})
      response, api_key = Octobat.request(:post, send_url, @api_key, email_data)
      refresh_from(response, api_key)
    end

    def confirm(confirmation_data = {})
      response, api_key = Octobat.request(:patch, confirm_url, @api_key, confirmation_data)
      refresh_from(response, api_key)
    end

    def items(params = {})
      Item.list(params.merge({credit_note: id }), @api_key)
    end

    def transactions(params = {})
      Transaction.list(params.merge(credit_note: id), @api_key)
    end

    private

      def send_url
        url + '/send'
      end

      def confirm_url
        url + '/confirm'
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octobat-2.0.8 lib/octobat/credit_note.rb
octobat-2.0.7 lib/octobat/credit_note.rb