Class: RDStation::Events
- Inherits:
-
Object
- Object
- RDStation::Events
- Includes:
- HTTParty
- Defined in:
- lib/rdstation/events.rb
Constant Summary collapse
- EVENTS_ENDPOINT =
'https://api.rd.services/platform/events'.freeze
Instance Method Summary collapse
- #create(payload) ⇒ Object
-
#initialize(auth_token) ⇒ Events
constructor
A new instance of Events.
Constructor Details
#initialize(auth_token) ⇒ Events
Returns a new instance of Events.
7 8 9 |
# File 'lib/rdstation/events.rb', line 7 def initialize(auth_token) @auth_token = auth_token end |
Instance Method Details
#create(payload) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rdstation/events.rb', line 11 def create(payload) response = self.class.post(EVENTS_ENDPOINT, headers: required_headers, body: payload.to_json) response_body = JSON.parse(response.body) return response_body unless errors?(response_body) RDStation::ErrorHandler.new(response).raise_errors end |