Sha256: c10d6e48fe70c5e950956d775d5bb517edf449262be615a1526a48f713029693

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

module Fire
  require 'connection/response'
  require 'connection/request'
  require 'model/model'

  require 'ostruct'

  def self.setup(options)
    configuration = {}
    configuration[:base_uri] = base_uri(options[:firebase_path])
    configuration[:auth] = (options[:firebase_auth] || {})
    @config = OpenStruct.new(configuration)
  end

  def self.config
    @config
  end

  def self.drop!
    connection.delete(?/)
  end

  def self.connection
    Fire::Connection::Request.new
  end

  private

  def self.base_uri(uri)
    raise ArgumentError.new('base_uri must be a valid https uri') if uri !~ URI::regexp(%w(https))
    uri.end_with?(?/) ? uri : (uri + ?/)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fire-model-0.0.8 lib/fire-model.rb
fire-model-0.0.7 lib/fire-model.rb
fire-model-0.0.6 lib/fire-model.rb