Class: MC2P::ActionsResourceMixin

Inherits:
ResourceMixin show all
Defined in:
lib/mixins.rb

Overview

Allows send requests of actions

Instance Method Summary collapse

Methods inherited from ResourceMixin

#_one_item, #detail_url, #initialize

Constructor Details

This class inherits a constructor from MC2P::ResourceMixin

Instance Method Details

#_one_item_action(func, resource_id, action, data = nil) ⇒ Object

Params:

func

function to make the request

resource_id

id to use on the requested url

action

action to use on the requested url

data

data passed in the request

Returns: response dictionary



318
319
320
321
322
323
324
325
326
327
328
# File 'lib/mixins.rb', line 318

def _one_item_action(func, resource_id, action, data = nil)
  url = detail_action_url(resource_id, action)
  @api_request.send(
    func,
    url,
    data,
    nil,
    self,
    resource_id
  )
end

#detail_action_url(resource_id, action) ⇒ Object

Params:

resource_id

id used on the url returned

action

action used on the url returned

Returns: url to make an action in an item



308
309
310
# File 'lib/mixins.rb', line 308

def detail_action_url(resource_id, action)
  "#{@path}#{resource_id}/#{action}/"
end