Class: MC2P::ReadOnlyObjectItem
- Inherits:
-
ObjectItem
- Object
- ObjectItemMixin
- ObjectItem
- MC2P::ReadOnlyObjectItem
- Defined in:
- lib/base.rb
Overview
Object item that allows retrieve an item
Direct Known Subclasses
CRObjectItem, CRUObjectItem, Currency, Gateway, PayData, Sale
Instance Attribute Summary
Attributes inherited from ObjectItemMixin
#_deleted, #json_dict, #resource
Class Method Summary collapse
-
.get(object_id) ⇒ Object
- Retrieve object with object_id and return Params:
object_id
-
Id to retrieve Returns: Object after retrieve.
- Retrieve object with object_id and return Params:
Instance Method Summary collapse
-
#initialize(json_dict, resource) ⇒ ReadOnlyObjectItem
constructor
- Initializes an object item Params:
json_dict
- Data of the object
resource
-
Resource used to delete, save, create or retrieve the object.
- Data of the object
- Initializes an object item Params:
-
#retrieve ⇒ Object
Retrieves the data of the object item.
Methods inherited from ObjectItem
#method_missing, #respond_to?, #respond_to_missing?, #set
Methods inherited from ObjectItemMixin
#id_required_and_not_deleted, #to_s
Constructor Details
#initialize(json_dict, resource) ⇒ ReadOnlyObjectItem
Initializes an object item Params:
json_dict
-
Data of the object
resource
-
Resource used to delete, save, create or retrieve the object
82 83 84 85 |
# File 'lib/base.rb', line 82 def initialize(json_dict, resource) @retrieve_mixin = RetrieveObjectItemMixin.new(json_dict, resource) super(json_dict, resource) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MC2P::ObjectItem
Class Method Details
.get(object_id) ⇒ Object
Retrieve object with object_id and return Params:
object_id
-
Id to retrieve
Returns: Object after retrieve
91 92 93 94 95 96 97 |
# File 'lib/base.rb', line 91 def self.get(object_id) obj = new({ @id_property => object_id }, resource) obj.retrieve obj end |
Instance Method Details
#retrieve ⇒ Object
Retrieves the data of the object item
100 101 102 103 104 105 |
# File 'lib/base.rb', line 100 def retrieve @retrieve_mixin.json_dict = @json_dict @retrieve_mixin._deleted = @_deleted @retrieve_mixin.retrieve @json_dict = @retrieve_mixin.json_dict end |