Sha256: 07af1362a9b8ebd4012b3864c76fc11938da93a710d89862e92c19450e637f6b

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

require "bundler/setup"
require "httparty"

require "apisync/version"
require "apisync/exceptions"
require "apisync/resource"
require "apisync/http_client"
require "apisync/http/url"
require "apisync/http/query_string"

class Apisync
  @@api_key = nil

  def initialize(api_key: nil)
    @api_key = api_key || @@api_key

    raise ArgumentError, "missing keyword: api_key" if @api_key.nil?
  end

  def method_missing(name, args = {}, &block)
    # overrides the instance api_key as `authorization`
    options = args.merge(api_key: @api_key)
    Apisync::Resource.new(name, options)
  end

  def self.api_key=(key)
    @@api_key = key
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apisync-0.1.4 lib/apisync.rb
apisync-0.1.3 lib/apisync.rb