Class: MC2P::CRResource

Inherits:
ReadOnlyResource show all
Defined in:
lib/base.rb

Overview

Resource that allows send requests of create, list and detail

Instance Method Summary collapse

Methods inherited from ReadOnlyResource

#list

Methods inherited from DetailOnlyResource

#detail

Methods inherited from ResourceMixin

#_one_item, #detail_url

Constructor Details

#initialize(api_request, path, object_item_class) ⇒ CRResource

Initializes a resource Params:

api_request

Api request used to make all the requests to the API

path

Path used to make all the requests to the API

object_item_class

Object item class used to return values



284
285
286
287
288
289
# File 'lib/base.rb', line 284

def initialize(api_request, path, object_item_class)
  super(api_request, path, object_item_class)
  @create_resource_mixin = CreateResourceMixin.new(api_request, path,
                                                   object_item_class,
                                                   @paginator_class)
end

Instance Method Details

#create(data) ⇒ Object

Params:

data

data used on the request

Returns: an object item class with the response of the server



294
295
296
# File 'lib/base.rb', line 294

def create(data)
  @create_resource_mixin.create(data)
end