Class: Beanstalk::API::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/beanstalkapp/base.rb

Class Method Summary collapse

Class Method Details

.add_prefix(str) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/beanstalkapp/base.rb', line 11

def self.add_prefix(str)
  str.gsub!(/^\//, '')
  class_eval(<<-CODE)
    def self.site
      URI.parse(File.join(Beanstalk::API::Base.site.to_s, #{str.inspect}))
    end
  CODE
end

.setup(options) ⇒ Object



4
5
6
7
8
9
# File 'lib/beanstalkapp/base.rb', line 4

def self.setup(options)
  options[:host] ||= "beanstalkapp.com"
  self.site = "https://#{options[:domain]}.#{options[:host]}/api"
  self.user = options[:login]
  self.password = options[:password]
end