Sha256: 6369d0e9794359cf4e2ae629ae2906e8aaace437132aced77c2983c48762da87

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 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
      response, api_key = Octobat.request(:patch, confirm_url, @api_key)
      refresh_from(response, api_key)
    end

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

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

    private

      def send_url
        url + '/send'
      end

      def confirm_url
        url + '/confirm'
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octobat-2.0.0 lib/octobat/credit_note.rb