Class: GmxCheckout::API

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gmxcheckout/api.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil) ⇒ API

Returns a new instance of API.



11
12
13
14
15
16
17
18
# File 'lib/gmxcheckout/api.rb', line 11

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

Class Method Details

.build_notification(params) ⇒ Object



7
8
9
# File 'lib/gmxcheckout/api.rb', line 7

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

Instance Method Details

#api_keyObject Also known as: key



24
25
26
# File 'lib/gmxcheckout/api.rb', line 24

def api_key
  @api_key || GmxCheckout.api_key
end

#subscriptionsObject



20
21
22
# File 'lib/gmxcheckout/api.rb', line 20

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