Class: MMS::Client
- Inherits:
-
Object
- Object
- MMS::Client
- Defined in:
- lib/mms/client.rb
Instance Attribute Summary collapse
-
#apikey ⇒ Object
Returns the value of attribute apikey.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #delete(path) ⇒ Hash
- #get(path) ⇒ Hash
-
#initialize(username = nil, apikey = nil, url = nil) ⇒ Client
constructor
A new instance of Client.
- #patch(path, data) ⇒ Hash
- #post(path, data) ⇒ Hash
- #put(path, data) ⇒ Hash
Constructor Details
#initialize(username = nil, apikey = nil, url = nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 |
# File 'lib/mms/client.rb', line 10 def initialize(username = nil, apikey = nil, url = nil) @username = username @apikey = apikey @url = url.nil? ? 'https://mms.mongodb.com:443/api/public/v1.0' : url end |
Instance Attribute Details
#apikey ⇒ Object
Returns the value of attribute apikey.
4 5 6 |
# File 'lib/mms/client.rb', line 4 def apikey @apikey end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/mms/client.rb', line 5 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/mms/client.rb', line 3 def username @username end |
Instance Method Details
#delete(path) ⇒ Hash
31 32 33 |
# File 'lib/mms/client.rb', line 31 def delete(path) _request(Net::HTTP::Delete, @url + path, @username, @apikey, nil) end |
#get(path) ⇒ Hash
18 19 20 |
# File 'lib/mms/client.rb', line 18 def get(path) _request(Net::HTTP::Get, @url + path, @username, @apikey, nil) end |
#patch(path, data) ⇒ Hash
38 39 40 |
# File 'lib/mms/client.rb', line 38 def patch(path, data) _request(Net::HTTP::Patch, @url + path, @username, @apikey, data) end |
#post(path, data) ⇒ Hash
25 26 27 |
# File 'lib/mms/client.rb', line 25 def post(path, data) _request(Net::HTTP::Post, @url + path, @username, @apikey, data) end |
#put(path, data) ⇒ Hash
45 46 47 |
# File 'lib/mms/client.rb', line 45 def put(path, data) _request(Net::HTTP::Put, @url + path, @username, @apikey, data) end |