Module: Bigcommerce::SubresourceActions::ClassMethods

Defined in:
lib/bigcommerce/subresource_actions.rb

Instance Method Summary collapse

Instance Method Details

#all(parent_id, params = {}) ⇒ Object

Raises:

  • (ArgumentError)

12
13
14
15
# File 'lib/bigcommerce/subresource_actions.rb', line 12

def all(parent_id, params = {})
  raise ArgumentError if parent_id.nil?
  get path.build(parent_id), params
end

#create(parent_id, params = {}) ⇒ Object

Raises:

  • (ArgumentError)

22
23
24
25
# File 'lib/bigcommerce/subresource_actions.rb', line 22

def create(parent_id, params = {})
  raise ArgumentError if parent_id.nil?
  post path.build(parent_id), params
end

#destroy(parent_id, resource_id, params = {}) ⇒ Object

Raises:

  • (ArgumentError)

32
33
34
35
# File 'lib/bigcommerce/subresource_actions.rb', line 32

def destroy(parent_id, resource_id, params = {})
  raise ArgumentError if [parent_id, resource_id].any?(&:nil?)
  delete path.build([parent_id, resource_id]), params
end

#destroy_all(parent_id, params = {}) ⇒ Object

Raises:

  • (ArgumentError)

37
38
39
40
# File 'lib/bigcommerce/subresource_actions.rb', line 37

def destroy_all(parent_id, params = {})
  raise ArgumentError if parent_id.nil?
  delete path.build(parent_id), params
end

#find(parent_id, resource_id, params = {}) ⇒ Object

Raises:

  • (ArgumentError)

17
18
19
20
# File 'lib/bigcommerce/subresource_actions.rb', line 17

def find(parent_id, resource_id, params = {})
  raise ArgumentError if [parent_id, resource_id].any?(&:nil?)
  get path.build([parent_id, resource_id]), params
end

#update(parent_id, resource_id, params = {}) ⇒ Object

Raises:

  • (ArgumentError)

27
28
29
30
# File 'lib/bigcommerce/subresource_actions.rb', line 27

def update(parent_id, resource_id, params = {})
  raise ArgumentError if [parent_id, resource_id].any?(&:nil?)
  put path.build([parent_id, resource_id]), params
end