Class: RDStation::Webhooks
- Inherits:
-
Object
- Object
- RDStation::Webhooks
- Includes:
- HTTParty
- Defined in:
- lib/rdstation/webhooks.rb
Instance Method Summary collapse
- #all ⇒ Object
- #by_uuid(uuid) ⇒ Object
- #create(payload) ⇒ Object
- #delete(uuid) ⇒ Object
-
#initialize(auth_token) ⇒ Webhooks
constructor
A new instance of Webhooks.
- #update(uuid, payload) ⇒ Object
Constructor Details
#initialize(auth_token) ⇒ Webhooks
Returns a new instance of Webhooks.
5 6 7 |
# File 'lib/rdstation/webhooks.rb', line 5 def initialize(auth_token) @auth_token = auth_token end |
Instance Method Details
#all ⇒ Object
9 10 11 12 |
# File 'lib/rdstation/webhooks.rb', line 9 def all response = self.class.get(base_url, headers: required_headers) ApiResponse.build(response) end |
#by_uuid(uuid) ⇒ Object
14 15 16 17 |
# File 'lib/rdstation/webhooks.rb', line 14 def by_uuid(uuid) response = self.class.get(base_url(uuid), headers: required_headers) ApiResponse.build(response) end |
#create(payload) ⇒ Object
19 20 21 22 |
# File 'lib/rdstation/webhooks.rb', line 19 def create(payload) response = self.class.post(base_url, headers: required_headers, body: payload.to_json) ApiResponse.build(response) end |
#delete(uuid) ⇒ Object
29 30 31 32 33 |
# File 'lib/rdstation/webhooks.rb', line 29 def delete(uuid) response = self.class.delete(base_url(uuid), headers: required_headers) return unless response.body RDStation::ErrorHandler.new(response).raise_errors end |
#update(uuid, payload) ⇒ Object
24 25 26 27 |
# File 'lib/rdstation/webhooks.rb', line 24 def update(uuid, payload) response = self.class.put(base_url(uuid), headers: required_headers, body: payload.to_json) ApiResponse.build(response) end |