Class: Tarpon::Request::Subscriber::Entitlement

Inherits:
Base
  • Object
show all
Defined in:
lib/tarpon/request/subscriber/entitlement.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_HEADERS

Instance Method Summary collapse

Constructor Details

#initialize(subscriber_path:, entitlement_identifier:, **opts) ⇒ Entitlement

Returns a new instance of Entitlement.



7
8
9
10
11
# File 'lib/tarpon/request/subscriber/entitlement.rb', line 7

def initialize(subscriber_path:, entitlement_identifier:, **opts)
  super(**opts)
  @subscriber_path = subscriber_path
  @entitlement_identifier = entitlement_identifier
end

Instance Method Details

#grant_promotional(duration:, start_time_ms: nil) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/tarpon/request/subscriber/entitlement.rb', line 13

def grant_promotional(duration:, start_time_ms: nil)
  body = {
    duration: duration,
    start_time_ms: start_time_ms
  }

  perform(method: :post, path: "#{path}/promotional", key: :secret, body: body)
end

#revoke_promotionalObject



22
23
24
# File 'lib/tarpon/request/subscriber/entitlement.rb', line 22

def revoke_promotional
  perform(method: :post, path: "#{path}/revoke_promotionals", key: :secret)
end