Sha256: 9016b62a293df55cd2908fbd7e9940d21fc86637eed007dfa37a41ff96823ca0

Contents?: true

Size: 786 Bytes

Versions: 6

Compression:

Stored size: 786 Bytes

Contents

module Paid
  class Customer < APIResource
    include Paid::APIOperations::Create
    include Paid::APIOperations::Delete
    include Paid::APIOperations::Update
    include Paid::APIOperations::List

    def generate_invoice(params={}, opts={})
      api_key, headers = Util.parse_opts(opts)
      response, api_key = Paid.request(
        :post, generate_invoice_url, api_key || @api_key, params, headers)
      # refresh_from(response, api_key)
      refresh_from({ :invoice => response }, api_key, true)
      invoice
    end

    def invoices
      Invoice.all({ :customer => id }, @api_key)
    end

    def transactions
      Transaction.all({ :customer => id }, @api_key)
    end

    private

    def generate_invoice_url
      api_url + '/generate_invoice'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
paid-0.1.0 lib/paid/customer.rb
paid-0.0.8 lib/paid/customer.rb
paid-0.0.7 lib/paid/customer.rb
paid-0.0.6 lib/paid/customer.rb
paid-0.0.5 lib/paid/customer.rb
paid-0.0.4 lib/paid/customer.rb