Class: TortoiseLabs::Client
- Inherits:
-
Object
- Object
- TortoiseLabs::Client
- Defined in:
- lib/tortoiselabs/client.rb
Class Method Summary collapse
- .auth_options ⇒ Object
- .base_uri ⇒ Object
- .base_uri=(value) ⇒ Object
- .get(path, options = {}) ⇒ Object
- .password=(value) ⇒ Object
- .post(path, options) ⇒ Object
- .username=(value) ⇒ Object
Class Method Details
.auth_options ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/tortoiselabs/client.rb', line 20 def self. if @username.nil? or @password.nil? raise NotAuthenticated end {:basic_auth => {:username => @username, :password => @password}} end |
.base_uri ⇒ Object
4 5 6 |
# File 'lib/tortoiselabs/client.rb', line 4 def self.base_uri @base_uri ||= "https://manage.tortois.es" end |
.base_uri=(value) ⇒ Object
8 9 10 |
# File 'lib/tortoiselabs/client.rb', line 8 def self.base_uri=(value) @base_uri = value.to_s.chomp("/") end |
.get(path, options = {}) ⇒ Object
28 29 30 |
# File 'lib/tortoiselabs/client.rb', line 28 def self.get(path, = {}) HTTParty.get(base_uri + path, .merge()) end |
.password=(value) ⇒ Object
16 17 18 |
# File 'lib/tortoiselabs/client.rb', line 16 def self.password=(value) @password = value end |
.post(path, options) ⇒ Object
32 33 34 35 |
# File 'lib/tortoiselabs/client.rb', line 32 def self.post(path, ) = {:body => }.merge() HTTParty.post(base_uri + path, ) end |
.username=(value) ⇒ Object
12 13 14 |
# File 'lib/tortoiselabs/client.rb', line 12 def self.username=(value) @username = value end |