Class: Intrinsic::AsyncEventTypesClient
- Inherits:
-
Object
- Object
- Intrinsic::AsyncEventTypesClient
- 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:) ⇒ AsyncEventTypesClient constructor
Constructor Details
#initialize(request_client:) ⇒ AsyncEventTypesClient
54 55 56 57 |
# File 'lib/intrinsic/event_types/client.rb', line 54 def initialize(request_client:) # @type [AsyncRequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
50 51 52 |
# File 'lib/intrinsic/event_types/client.rb', line 50 def request_client @request_client end |
Instance Method Details
#create_event_type(name:, fields:, request_options: nil) ⇒ EventTypeObject
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/intrinsic/event_types/client.rb', line 79 def create_event_type(name:, fields:, request_options: nil) Async do 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 end |
#get_event_types(request_options: nil) ⇒ ListEventTypesResponse
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/intrinsic/event_types/client.rb', line 61 def get_event_types(request_options: nil) Async do 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 end |