Class: Square::EventsApi
- Defined in:
- lib/square/api/events_api.rb
Overview
EventsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#disable_events ⇒ DisableEventsResponse Hash
Disables events to prevent them from being searchable.
-
#enable_events ⇒ EnableEventsResponse Hash
Enables events to make them searchable.
-
#list_event_types(api_version: nil) ⇒ ListEventTypesResponse Hash
Lists all event types that you can subscribe to as webhooks or query using the Events API.
-
#search_events(body:) ⇒ SearchEventsResponse Hash
Search for Square API events that occur within a 28-day timeframe.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from Square::BaseApi
Instance Method Details
#disable_events ⇒ DisableEventsResponse Hash
Disables events to prevent them from being searchable. All events are disabled by default. You must enable events to make them searchable. Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/square/api/events_api.rb', line 32 def disable_events new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/events/disable', 'default') .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#enable_events ⇒ EnableEventsResponse Hash
Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/square/api/events_api.rb', line 49 def enable_events new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/events/enable', 'default') .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_event_types(api_version: nil) ⇒ ListEventTypesResponse Hash
Lists all event types that you can subscribe to as webhooks or query using the Events API. to list event types. Setting this field overrides the default version used by the application.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/square/api/events_api.rb', line 69 def list_event_types(api_version: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/events/types', 'default') .query_param(new_parameter(api_version, key: 'api_version')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_events(body:) ⇒ SearchEventsResponse Hash
Search for Square API events that occur within a 28-day timeframe. the fields to POST for the request. See the corresponding object definition for field details.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/square/api/events_api.rb', line 9 def search_events(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/events', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |