Sha256: a5188ec94b857443e1579a41fdfc107d9550fdbc0258225c8f867802023ef1fa

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

module GmxCheckout
  class API
    extend Forwardable

    def_delegators :@connection, :get, :post, :put, :patch

    def self.build_notification(params)
      Models::Notification.new params
    end

    def initialize(api_key = nil)
      @api_key = api_key
      @connection = Faraday.new url: 'https://www.gmxcheckout.com.br' do |conn|
        conn.use JsonMiddleware
        conn.request :url_encoded
        conn.adapter :net_http
      end
    end

    def subscriptions
      @subscriptions ||= Subscriptions.new(self)
    end

    def api_key
      @api_key || GmxCheckout.api_key
    end

    alias key api_key
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gmxcheckout-0.2.0 lib/gmxcheckout/api.rb
gmxcheckout-0.1.0 lib/gmxcheckout/api.rb