Class: Shark::Subscription

Inherits:
Base
  • Object
show all
Extended by:
Shark::SubscriptionService::Resource
Defined in:
lib/shark/subscription.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

add_datetime_accessors

Class Method Details

.create_multiple(attributes) ⇒ Object



10
11
12
# File 'lib/shark/subscription.rb', line 10

def self.create_multiple(attributes)
  bulk_creation(subscriptions_attributes(attributes))
end

.destroy_multiple(attributes) ⇒ Object



14
15
16
# File 'lib/shark/subscription.rb', line 14

def self.destroy_multiple(attributes)
  bulk_deletion(subscriptions_attributes(attributes))
end

.subscriptions_attributes(attributes) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/shark/subscription.rb', line 32

def self.subscriptions_attributes(attributes)
  {
    data: {
      type: 'bulk-subscriptions',
      attributes: {
        subscriptions: attributes
      }
    }
  }
end

Instance Method Details

#saveObject



18
19
20
21
22
23
24
25
# File 'lib/shark/subscription.rb', line 18

def save
  if self['id'].present?
    raise Shark::ActionNotSupportedError,
          'Shark::Subscription#save is not supported for persisted subscriptions'
  else
    super
  end
end

#update_attributes(_attributes = {}) ⇒ Object



27
28
29
30
# File 'lib/shark/subscription.rb', line 27

def update_attributes(_attributes = {})
  raise Shark::ActionNotSupportedError,
        'Shark::Subscription#update_attributes is not supported'
end