Class: Whatsapp::SubscribedApp::List

Inherits:
Object
  • Object
show all
Extended by:
ResponseHandling, Transport
Defined in:
lib/ruby/whatsapp/subscribed_app/list.rb

Overview

Constant Summary

Constants included from ResponseHandling

ResponseHandling::MAX_ERROR_BODY

Class Method Summary collapse

Class Method Details

.call(client: Client.new, fields: nil) ⇒ Response::Collection

Parameters:

  • client (Whatsapp::Client) (defaults to: Client.new)

    The WhatsApp client instance.

  • fields (Array<String>, String, nil) (defaults to: nil)

    Restrict each app to these fields (id, name, link).

Returns:

Raises:

  • (Error)

    if no WABA ID is configured, or the request fails.



17
18
19
20
21
22
23
24
# File 'lib/ruby/whatsapp/subscribed_app/list.rb', line 17

def call(client: Client.new, fields: nil)
  params = fields ? { fields: Array(fields).join(",") } : {}
  response = client.connection.get(edge_path(client), params:)

  Response::Collection.deserialize(
    parse_json(handle_response!(response, error_class: Error, action: "list subscribed apps"))
  )
end