Class: XTwitterScraper::Resources::Integrations

Inherits:
Object
  • Object
show all
Defined in:
lib/x_twitter_scraper/resources/integrations.rb

Overview

Push notification integrations (Telegram)

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Integrations

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Integrations.

Parameters:



177
178
179
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 177

def initialize(client:)
  @client = client
end

Instance Method Details

#create(config:, event_types:, name:, type: :telegram, request_options: {}) ⇒ XTwitterScraper::Models::Integration

Create integration

Parameters:

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 24

def create(params)
  parsed, options = XTwitterScraper::IntegrationCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "integrations",
    body: parsed,
    model: XTwitterScraper::Integration,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ XTwitterScraper::Models::IntegrationDeleteResponse

Delete integration

Parameters:

Returns:

See Also:



120
121
122
123
124
125
126
127
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 120

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["integrations/%1$s", id],
    model: XTwitterScraper::Models::IntegrationDeleteResponse,
    options: params[:request_options]
  )
end

#list(request_options: {}) ⇒ XTwitterScraper::Models::IntegrationListResponse

List integrations

Parameters:

Returns:

See Also:



100
101
102
103
104
105
106
107
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 100

def list(params = {})
  @client.request(
    method: :get,
    path: "integrations",
    model: XTwitterScraper::Models::IntegrationListResponse,
    options: params[:request_options]
  )
end

#list_deliveries(id, limit: nil, request_options: {}) ⇒ XTwitterScraper::Models::IntegrationListDeliveriesResponse

List integration delivery history

Parameters:

  • id (String)

    Resource ID (stringified bigint)

  • limit (Integer)

    Maximum number of items to return (1-100, default 50)

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 142

def list_deliveries(id, params = {})
  parsed, options = XTwitterScraper::IntegrationListDeliveriesParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["integrations/%1$s/deliveries", id],
    query: query,
    model: XTwitterScraper::Models::IntegrationListDeliveriesResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::Integration

Get integration details

Parameters:

Returns:

See Also:



46
47
48
49
50
51
52
53
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 46

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["integrations/%1$s", id],
    model: XTwitterScraper::Integration,
    options: params[:request_options]
  )
end

#send_test(id, request_options: {}) ⇒ XTwitterScraper::Models::IntegrationSendTestResponse

Send test delivery

Parameters:

Returns:

See Also:



165
166
167
168
169
170
171
172
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 165

def send_test(id, params = {})
  @client.request(
    method: :post,
    path: ["integrations/%1$s/test", id],
    model: XTwitterScraper::Models::IntegrationSendTestResponse,
    options: params[:request_options]
  )
end

#update(id, event_types: nil, filters: nil, is_active: nil, message_template: nil, name: nil, scope_all_monitors: nil, silent_push: nil, request_options: {}) ⇒ XTwitterScraper::Models::Integration

Update integration

Parameters:

  • id (String)

    Resource ID (stringified bigint)

  • event_types (Array<Symbol, XTwitterScraper::Models::EventType>)

    Array of event types to subscribe to.

  • filters (Hash{Symbol=>Object})

    Event filter rules (JSON)

  • is_active (Boolean)
  • message_template (Hash{Symbol=>Object})

    Custom message template (JSON)

  • name (String)
  • scope_all_monitors (Boolean)
  • silent_push (Boolean)
  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



80
81
82
83
84
85
86
87
88
89
# File 'lib/x_twitter_scraper/resources/integrations.rb', line 80

def update(id, params = {})
  parsed, options = XTwitterScraper::IntegrationUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["integrations/%1$s", id],
    body: parsed,
    model: XTwitterScraper::Integration,
    options: options
  )
end