Class: Whatsapp::SubscribedApp::Response::Collection
- Inherits:
-
Object
- Object
- Whatsapp::SubscribedApp::Response::Collection
- Includes:
- Enumerable
- Defined in:
- lib/ruby/whatsapp/subscribed_app/response/collection.rb
Overview
The apps currently subscribed to a WABA's webhook notifications: {data}.
Enumerable over its apps, so list.map(&:name) reads naturally without
reaching for .data first.
Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/reference/whatsapp-business-account/subscribed-apps-api
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #each {|app| ... } ⇒ Enumerator
-
#initialize(data: []) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(data: []) ⇒ Collection
Returns a new instance of Collection.
19 20 21 |
# File 'lib/ruby/whatsapp/subscribed_app/response/collection.rb', line 19 def initialize(data: []) @data = data end |
Instance Attribute Details
#data ⇒ Array<App>
16 17 18 |
# File 'lib/ruby/whatsapp/subscribed_app/response/collection.rb', line 16 def data @data end |
Class Method Details
.deserialize(response) ⇒ Collection
26 27 28 29 30 |
# File 'lib/ruby/whatsapp/subscribed_app/response/collection.rb', line 26 def deserialize(response) response ||= {} new(data: Array(response["data"]).map { |entry| App.deserialize(entry) }) end |
Instance Method Details
#each {|app| ... } ⇒ Enumerator
35 36 37 |
# File 'lib/ruby/whatsapp/subscribed_app/response/collection.rb', line 35 def each(&) data.each(&) end |