Sha256: 822983dec9104ac1fc3c39d2ba345aedab51adc2f75fbe0749f4fe0b29e9ab6a

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

#   Lightspeed Restaurant Ruby Bindings
#   API spec at http://stating-integration.posios.com/PosServer/swagger-ui.html

require 'excon'
require 'json'

require 'lightspeed_restaurant/version'
require 'lightspeed_restaurant/request'
require 'lightspeed_restaurant/configuration'

require 'lightspeed_restaurant/customer'
require 'lightspeed_restaurant/customer_credit_change'
require 'lightspeed_restaurant/customer_loyalty_card'
require 'lightspeed_restaurant/customer_establishment_order'
require 'lightspeed_restaurant/receipt'
require 'lightspeed_restaurant/company'
require 'lightspeed_restaurant/payment_type'
require 'lightspeed_restaurant/product_group'
require 'lightspeed_restaurant/product_group_product'

module LightspeedRestaurantClient
  class << self
    attr_accessor :api_token, :base_uri, :logger

    def default_configuration
      Configuration.new(@api_token, @base_uri)
    end

    def get(path, query = {}, configuration = nil)
      request(path, {}, query, configuration).perform(method: :get)
    end

    def post(path, body = {}, query = {}, configuration = nil)
      request(path, body, query, configuration).perform(method: :post)
    end

    def put(path, body = {}, query = {}, configuration = nil)
      request(path, body, query, configuration).perform(method: :put)
    end

    def delete(path, query = {}, configuration = nil)
      request(path, {}, query, configuration).perform(method: :delete)
    end

    private

    def request(path, body, query, configuration = nil)
      configuration ||= default_configuration
      Request.new(configuration.base_uri, path, configuration.api_token, body, query, @logger)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lightspeed_restaurant-3.3.3 lib/lightspeed_restaurant.rb
lightspeed_restaurant-3.3.2 lib/lightspeed_restaurant.rb
lightspeed_restaurant-3.3.1 lib/lightspeed_restaurant.rb
lightspeed_restaurant-3.3.0 lib/lightspeed_restaurant.rb
lightspeed_restaurant-3.2.0 lib/lightspeed_restaurant.rb
lightspeed_restaurant-3.1.0 lib/lightspeed_restaurant.rb