Sha256: fdff13922565d78349deb0939f9c1a2efc78ae6ce7466dd503576bda10f0c9d2

Contents?: true

Size: 867 Bytes

Versions: 2

Compression:

Stored size: 867 Bytes

Contents

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

    def pay(payment_data)
      response, api_key = Octobat.request(:patch, pay_url, @api_key, {payment: payment_data})
      refresh_from(response, api_key)
    end
    
    def send(enforce_errors = false)
      response, api_key = Octobat.request(:post, send_url, @api_key, {enforce_errors: enforce_errors})
      refresh_from(response, api_key)
    end
    
    
    def confirm
      response, api_key = Octobat.request(:patch, confirm_url, @api_key)
      refresh_from(response, api_key)
    end

    private

      def pay_url
        url + '/pay'
      end
    
      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-0.0.12 lib/octobat/invoice.rb
octobat-0.0.11 lib/octobat/invoice.rb