Class: RDStation::Events

Inherits:
Object
  • Object
show all
Includes:
HTTParty, RetryableRequest
Defined in:
lib/rdstation/events.rb

Constant Summary

Constants included from RetryableRequest

RetryableRequest::MAX_RETRIES

Instance Method Summary collapse

Methods included from RetryableRequest

#refresh_access_token, #retry_possible?, #retryable_request

Constructor Details

#initialize(authorization:) ⇒ Events

Returns a new instance of Events.



8
9
10
# File 'lib/rdstation/events.rb', line 8

def initialize(authorization:)
  @authorization = authorization
end

Instance Method Details

#create(payload) ⇒ Object



12
13
14
15
16
17
# File 'lib/rdstation/events.rb', line 12

def create(payload)
  retryable_request(@authorization) do |authorization|
    response = self.class.post(base_url, headers: authorization.headers, body: payload.to_json)
    ApiResponse.build(response)
  end
end