Sha256: 5e0368d8776ada3376871bbcd2489a15437ef08014665080cbc2bb1e0b51b660
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require "fmrest/v1/token_session" require "uri" module FmRest module V1 BASE_PATH = "/fmi/data/v1/databases".freeze class << self def build_connection(options = FmRest.config, &block) base_connection(options) do |conn| conn.use TokenSession, options conn.request :json if options[:log] conn.response :logger, nil, bodies: true, headers: true end # Allow overriding the default response middleware if block_given? yield conn else conn.response :json end conn.adapter Faraday.default_adapter end end def base_connection(options = FmRest.config, &block) # TODO: Make HTTPS optional Faraday.new("https://#{options.fetch(:host)}#{BASE_PATH}/#{URI.escape(options.fetch(:database))}/".freeze, &block) end def session_path(token = nil) url = "sessions" url += "/#{token}" if token url end def record_path(layout, id = nil) url = "layouts/#{URI.escape(layout.to_s)}/records" url += "/#{id}" if id url end def find_path(layout) "layouts/#{URI.escape(layout.to_s)}/_find" end #def globals_path #end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fmrest-0.1.0 | lib/fmrest/v1.rb |