Class: Creem::Resources::Subscriptions

Inherits:
Base
  • Object
show all
Defined in:
lib/creem/resources/subscriptions.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Creem::Resources::Base

Instance Method Details

#cancel(id, mode: nil, on_execute: nil) ⇒ Object



23
24
25
26
27
28
# File 'lib/creem/resources/subscriptions.rb', line 23

def cancel(id, mode: nil, on_execute: nil)
  body = {}
  body[:mode] = mode if mode
  body[:onExecute] = on_execute if on_execute
  post("/subscriptions/#{id}/cancel", body)
end

#list(page_number: 1, page_size: 10) ⇒ Object



8
9
10
# File 'lib/creem/resources/subscriptions.rb', line 8

def list(page_number: 1, page_size: 10)
  get("/subscriptions/search", page_number: page_number, page_size: page_size)
end

#retrieve(subscription_id) ⇒ Object



12
13
14
# File 'lib/creem/resources/subscriptions.rb', line 12

def retrieve(subscription_id)
  get("/subscriptions", subscription_id: subscription_id)
end

#update(id, items: nil, update_behavior: nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/creem/resources/subscriptions.rb', line 16

def update(id, items: nil, update_behavior: nil)
  body = {}
  body[:items] = items if items
  body[:update_behavior] = update_behavior if update_behavior
  post("/subscriptions/#{id}", body)
end