Class: Userlist::Push::Client
- Inherits:
-
Object
- Object
- Userlist::Push::Client
- Includes:
- Logging
- Defined in:
- lib/userlist/push/client.rb
Instance Method Summary collapse
- #delete(endpoint) ⇒ Object
- #get(endpoint) ⇒ Object
-
#initialize(config = {}) ⇒ Client
constructor
A new instance of Client.
- #post(endpoint, payload = nil) ⇒ Object
- #put(endpoint, payload = nil) ⇒ Object
Methods included from Logging
Constructor Details
#initialize(config = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/userlist/push/client.rb', line 11 def initialize(config = {}) @config = Userlist.config.merge(config) raise Userlist::ConfigurationError, :push_key unless @config.push_key raise Userlist::ConfigurationError, :push_endpoint unless @config.push_endpoint end |
Instance Method Details
#delete(endpoint) ⇒ Object
30 31 32 |
# File 'lib/userlist/push/client.rb', line 30 def delete(endpoint) request(Net::HTTP::Delete, endpoint) end |
#get(endpoint) ⇒ Object
18 19 20 |
# File 'lib/userlist/push/client.rb', line 18 def get(endpoint) request(Net::HTTP::Get, endpoint) end |
#post(endpoint, payload = nil) ⇒ Object
22 23 24 |
# File 'lib/userlist/push/client.rb', line 22 def post(endpoint, payload = nil) request(Net::HTTP::Post, endpoint, payload) end |
#put(endpoint, payload = nil) ⇒ Object
26 27 28 |
# File 'lib/userlist/push/client.rb', line 26 def put(endpoint, payload = nil) request(Net::HTTP::Put, endpoint, payload) end |