Sha256: a8773b266aa950002ea754d90104b45b2b9f552af5f47160ee4f3f55a09cf592

Contents?: true

Size: 786 Bytes

Versions: 8

Compression:

Stored size: 786 Bytes

Contents

module Billimatic
  class Client
    attr_reader :http

    def initialize(token)
      @http = Http.new(token)
    end

    def authenticated?
      http.get("/companies/search?cnpj=auth_test") do |response|
        response.code == 200
      end
    rescue RequestError => e
      raise e unless e.code == 401
      false
    end

    def plans
      Resources::Plan.new(http)
    end

    def subscriptions
      Resources::Subscription.new(http)
    end

    def contracts
      Resources::Contract.new(http)
    end

    def invoices
      Resources::Invoice.new(http)
    end

    def invoice_rules
      Resources::InvoiceRule.new(http)
    end

    def companies
      Resources::Company.new(http)
    end

    def webhooks
      Resources::Webhook.new(http)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
billimatic-client-0.5.1 lib/billimatic/client.rb
billimatic-client-0.5.0 lib/billimatic/client.rb
billimatic-client-0.4.0 lib/billimatic/client.rb
billimatic-client-0.3.0 lib/billimatic/client.rb
billimatic-client-0.2.1 lib/billimatic/client.rb
billimatic-client-0.1.2 lib/billimatic/client.rb
billimatic-client-0.1.1 lib/billimatic/client.rb
billimatic-client-0.1.0 lib/billimatic/client.rb