Class: Crowbar::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/crowbar/core.rb

Constant Summary collapse

API_BASE =
"/api/v2/"

Instance Method Summary collapse

Constructor Details

#initialize(url = "http://127.0.0.1:3000", username = "crowbar", password = "crowbar") ⇒ Core

Returns a new instance of Core.



28
29
30
31
32
33
34
# File 'lib/crowbar/core.rb', line 28

def initialize(url = "http://127.0.0.1:3000", username = "crowbar", password = "crowbar")
    debug "initializing #{@url}"
    @url = url
    @username = username
    @password = password
    debug "initialize #{@url}"
end

Instance Method Details

#delete(path) ⇒ Object



48
49
50
# File 'lib/crowbar/core.rb', line 48

def delete(path)
  go(Net::HTTP::Delete,path)
end

#get(path) ⇒ Object



36
37
38
# File 'lib/crowbar/core.rb', line 36

def get(path)
  go(Net::HTTP::Get,path)
end

#post(path, data = nil) ⇒ Object



40
41
42
# File 'lib/crowbar/core.rb', line 40

def post(path, data=nil)
  go(Net::HTTP::Post,path,data)
end

#put(path, data = nil) ⇒ Object



44
45
46
# File 'lib/crowbar/core.rb', line 44

def put(path, data=nil)
  go(Net::HTTP::Put,path,data)
end