class FOaaS::FO

Public Class Methods

new(options = {}) click to toggle source
# File lib/foaas/f_o.rb, line 3
def initialize(options = {})
  options = {
    resource:     'off',
    name:         nil,
    from:         'me',
    root_url:     'http://foaas.herokuapp.com',
    http_headers: {
      "Accept"       => "application/json",
    }
  }.merge(options)

  options.merge!({
    uri: [
      options[:root_url],
      options[:resource],
      options[:name],
      options[:from]
    ].compact.join("/")
  })

  [:root_url, :resource, :name, :from].map do |o|
    options.delete o
  end

  load_options(:uri, :http_headers, options)
end

Public Instance Methods

execute!() click to toggle source
# File lib/foaas/f_o.rb, line 30
def execute!
  return result(true, JSON.parse(open(@uri, @http_headers).read))
end