Sha256: 775d20b2f23a3fa2f92ec3ed27a85f95486c8fa377470bc3a908c9c43cb9331c

Contents?: true

Size: 698 Bytes

Versions: 4

Compression:

Stored size: 698 Bytes

Contents

module Moip2

  class InvoiceApi
    attr_reader :client

    def initialize(client)
      @client = client
    end

    def base_path
      "/v2/invoices"
    end

    def show(invoice_external_id)
      Resource::Invoice.new client, client.get("#{base_path}/#{invoice_external_id}")
    end

    def create(invoice)
      Resource::Invoice.new client, client.post(base_path, invoice)
    end

    def update(invoice_external_id, invoice)
      Resource::Invoice.new client, client.put("#{base_path}/#{invoice_external_id}", invoice)
    end

    def list(begin_date, end_date)
      Resource::Invoice.new client, client.get("#{base_path}?begin=#{begin_date}&end=#{end_date}")
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
moip2-0.1.4 lib/moip2/invoice_api.rb
moip2-0.1.3 lib/moip2/invoice_api.rb
moip2-0.1.1 lib/moip2/invoice_api.rb
moip2-0.1.0 lib/moip2/invoice_api.rb