Class: MC2P::CRUDResource
- Inherits:
-
CRResource
- Object
- ResourceMixin
- Resource
- DetailOnlyResource
- ReadOnlyResource
- CRResource
- MC2P::CRUDResource
- Defined in:
- lib/base.rb
Overview
Resource that allows send requests of delete, change, create, list and detail
Direct Known Subclasses
CouponResource, PlanResource, ProductResource, ShippingResource, TaxResource
Instance Method Summary collapse
-
#change(resource_id, data) ⇒ Object
- Params:
resource_id - id to request
data -
data used on the request Returns: an object item class with the response of the server.
- id to request
- Params:
-
#delete(resource_id) ⇒ Object
Params:
resource_id::id to request. -
#initialize(api_request, path, object_item_class) ⇒ CRUDResource
constructor
- 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.
- Path used to make all the requests to the API
- Api request used to make all the requests to the API
- Initializes a resource Params:
Methods inherited from CRResource
Methods inherited from ReadOnlyResource
Methods inherited from DetailOnlyResource
Methods inherited from ResourceMixin
Constructor Details
#initialize(api_request, path, object_item_class) ⇒ CRUDResource
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
307 308 309 310 311 312 313 314 315 |
# File 'lib/base.rb', line 307 def initialize(api_request, path, object_item_class) super(api_request, path, object_item_class) @change_resource_mixin = ChangeResourceMixin.new(api_request, path, object_item_class, @paginator_class) @delete_resource_mixin = DeleteResourceMixin.new(api_request, path, object_item_class, @paginator_class) end |
Instance Method Details
#change(resource_id, data) ⇒ Object
Params:
resource_id-
id to request
data-
data used on the request
Returns: an object item class with the response of the server
321 322 323 |
# File 'lib/base.rb', line 321 def change(resource_id, data) @change_resource_mixin.change(resource_id, data) end |
#delete(resource_id) ⇒ Object
Params: resource_id::id to request
327 328 329 |
# File 'lib/base.rb', line 327 def delete(resource_id) @delete_resource_mixin.delete(resource_id) end |