Class: Intrinsic::EventTypesClient
- Inherits:
-
Object
- Object
- Intrinsic::EventTypesClient
- Defined in:
- lib/intrinsic/event_types/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
- #create_event_type(name:, fields:, request_options: nil) ⇒ EventTypeObject
- #get_event_types(request_options: nil) ⇒ ListEventTypesResponse
- #initialize(request_client:) ⇒ EventTypesClient constructor
Constructor Details
#initialize(request_client:) ⇒ EventTypesClient
15 16 17 18 |
# File 'lib/intrinsic/event_types/client.rb', line 15 def initialize(request_client:) # @type [RequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
11 12 13 |
# File 'lib/intrinsic/event_types/client.rb', line 11 def request_client @request_client end |
Instance Method Details
#create_event_type(name:, fields:, request_options: nil) ⇒ EventTypeObject
38 39 40 41 42 43 44 45 46 |
# File 'lib/intrinsic/event_types/client.rb', line 38 def create_event_type(name:, fields:, request_options: nil) response = @request_client.conn.post("/api/v2/event-types") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X-API-Key"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), name: name, fields: fields }.compact end EventTypeObject.from_json(json_object: response.body) end |
#get_event_types(request_options: nil) ⇒ ListEventTypesResponse
22 23 24 25 26 27 28 29 |
# File 'lib/intrinsic/event_types/client.rb', line 22 def get_event_types(request_options: nil) response = @request_client.conn.get("/api/v2/event-types") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X-API-Key"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact end ListEventTypesResponse.from_json(json_object: response.body) end |