Sha256: 597a6358023b6f293443540c40ac4131cd9d2a365373ad4aae94b3321dad2f2c

Contents?: true

Size: 471 Bytes

Versions: 5

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module NovaposhtaApi
  class Resource
    attr_reader :connection

    HTTP_METHODS = %i[get post patch put delete].freeze
    CACHE_OPTIONS = {expires_in: 1.day}.freeze

    def initialize(connection: nil)
      @connection = connection
    end

    HTTP_METHODS.each do |http_method|
      define_method http_method do |*args|
        response = connection.request(http_method, *args)
        response['data']
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
novaposhta_api-0.1.4 lib/novaposhta_api/resource.rb
novaposhta_api-0.1.3 lib/novaposhta_api/resource.rb
novaposhta_api-0.1.2 lib/novaposhta_api/resource.rb
novaposhta_api-0.1.1 lib/novaposhta_api/resource.rb
novaposhta_api-0.1.0 lib/novaposhta_api/resource.rb