Class: Tarpon::Request::Subscriber

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

Defined Under Namespace

Classes: Attribute, Entitlement, Offering, Subscription

Constant Summary

Constants inherited from Base

Base::DEFAULT_HEADERS

Instance Method Summary collapse

Constructor Details

#initialize(app_user_id:, **opts) ⇒ Subscriber

Returns a new instance of Subscriber.



6
7
8
9
# File 'lib/tarpon/request/subscriber.rb', line 6

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

Instance Method Details

#attributesObject



27
28
29
# File 'lib/tarpon/request/subscriber.rb', line 27

def attributes
  self.class::Attribute.new(subscriber_path: path, client: @client)
end

#deleteObject



15
16
17
# File 'lib/tarpon/request/subscriber.rb', line 15

def delete
  perform(method: :delete, path: path, key: :secret)
end

#entitlements(entitlement_identifier) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/tarpon/request/subscriber.rb', line 19

def entitlements(entitlement_identifier)
  self.class::Entitlement.new(
    subscriber_path: path,
    entitlement_identifier: entitlement_identifier,
    client: @client
  )
end

#get_or_createObject

rubocop:disable Naming/AccessorMethodName



11
12
13
# File 'lib/tarpon/request/subscriber.rb', line 11

def get_or_create # rubocop:disable Naming/AccessorMethodName
  perform(method: :get, path: path, key: :public)
end

#offeringsObject



31
32
33
# File 'lib/tarpon/request/subscriber.rb', line 31

def offerings
  self.class::Offering.new(subscriber_path: path, client: @client)
end

#subscriptions(product_id) ⇒ Object



35
36
37
# File 'lib/tarpon/request/subscriber.rb', line 35

def subscriptions(product_id)
  self.class::Subscription.new(subscriber_path: path, product_id: product_id, client: @client)
end