Class: WeBee::Api

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.hostObject

Returns the value of attribute host.



80
81
82
# File 'lib/webee.rb', line 80

def host
  @host
end

.passwordObject

Returns the value of attribute password.



80
81
82
# File 'lib/webee.rb', line 80

def password
  @password
end

.portObject

Returns the value of attribute port.



80
81
82
# File 'lib/webee.rb', line 80

def port
  @port
end

.urlObject

Returns the value of attribute url.



80
81
82
# File 'lib/webee.rb', line 80

def url
  @url
end

.userObject

Returns the value of attribute user.



80
81
82
# File 'lib/webee.rb', line 80

def user
  @user
end

Class Method Details

.build_url(url) ⇒ Object



86
87
88
89
90
91
# File 'lib/webee.rb', line 86

def build_url(url)
  port ||= 80
  uri = URI.parse(url)
  @host = uri.host
  "#{uri.scheme}://#{user}:#{password}@#{uri.host}:#{uri.port}#{uri.path}"
end

.test_authObject



94
95
96
97
98
99
100
101
# File 'lib/webee.rb', line 94

def self.test_auth
  begin
    RestClient.get Api.url
  rescue Exception
    return false
  end
  true
end