Class: Whatsapp::Webhook::Status::Pricing

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/whatsapp/webhook/status/pricing.rb

Overview

The billing details attached to a status update.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(billable:, pricing_model:, category:) ⇒ Pricing

Returns a new instance of Pricing.



20
21
22
23
24
# File 'lib/ruby/whatsapp/webhook/status/pricing.rb', line 20

def initialize(billable:, pricing_model:, category:)
  @billable = billable
  @pricing_model = pricing_model
  @category = category
end

Instance Attribute Details

#billableBoolean?

Returns:

  • (Boolean, nil)


10
11
12
# File 'lib/ruby/whatsapp/webhook/status/pricing.rb', line 10

def billable
  @billable
end

#categoryString?

Returns e.g. "service", "marketing", "utility", "authentication".

Returns:

  • (String, nil)

    e.g. "service", "marketing", "utility", "authentication".



18
19
20
# File 'lib/ruby/whatsapp/webhook/status/pricing.rb', line 18

def category
  @category
end

#pricing_modelString?

Returns:

  • (String, nil)


14
15
16
# File 'lib/ruby/whatsapp/webhook/status/pricing.rb', line 14

def pricing_model
  @pricing_model
end

Class Method Details

.deserialize(data) ⇒ Pricing

Parameters:

  • data (Hash)

    The raw pricing hash.

Returns:



29
30
31
32
33
# File 'lib/ruby/whatsapp/webhook/status/pricing.rb', line 29

def deserialize(data)
  data ||= {}

  new(billable: data["billable"], pricing_model: data["pricing_model"], category: data["category"])
end