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
- #get(path) ⇒ Hash
-
#initialize(username = nil, apikey = nil, url = nil) ⇒ Client
constructor
A new instance of Client.
- #post(path, data) ⇒ Hash
Constructor Details
#initialize(username = nil, apikey = nil, url = nil) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 |
# File 'lib/mms/client.rb', line 12 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.
6 7 8 |
# File 'lib/mms/client.rb', line 6 def apikey @apikey end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/mms/client.rb', line 7 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/mms/client.rb', line 5 def username @username end |
Instance Method Details
#get(path) ⇒ Hash
20 21 22 |
# File 'lib/mms/client.rb', line 20 def get(path) _request(Net::HTTP::Get, @url + path, @username, @apikey, nil) end |
#post(path, data) ⇒ Hash
27 28 29 |
# File 'lib/mms/client.rb', line 27 def post(path, data) _request(Net::HTTP::Post, @url + path, @username, @apikey, data) end |