Class: Blueticks::Resources::EnginesResource

Inherits:
BaseResource show all
Defined in:
lib/blueticks/resources/engines.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#client

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from Blueticks::BaseResource

Instance Method Details

#listObject

List engines.

List the WhatsApp engines connected to the workspace. Returns an Array of Engine (empty when no engine is paired) — this endpoint is not paginated.



14
15
16
17
18
19
20
21
22
# File 'lib/blueticks/resources/engines.rb', line 14

def list
  env = client.request("GET", "/v1/engines")
  data = env.is_a?(Hash) ? env["data"] : nil
  unless data.is_a?(Array)
    raise Errors::ValidationError.new(message: "Expected array `data` in engines.list response")
  end

  data.map { |item| Types::Engine.from_hash(item) }
end