Module: EacRest::Entity::Children
- Defined in:
- lib/eac_rest/entity/children.rb
Instance Method Summary collapse
- #child_entity(entity_class, data_or_id, options = {}) ⇒ EacRest::Entity
- #child_list(entity_class, path_suffix) ⇒ Enumerable<T>
Instance Method Details
#child_entity(entity_class, data_or_id, options = {}) ⇒ EacRest::Entity
10 11 12 |
# File 'lib/eac_rest/entity/children.rb', line 10 def child_entity(entity_class, data_or_id, = {}) api.entity(entity_class, data_or_id, .merge(OPTION_PARENT => self)) end |
#child_list(entity_class, path_suffix) ⇒ Enumerable<T>
17 18 19 20 21 |
# File 'lib/eac_rest/entity/children.rb', line 17 def child_list(entity_class, path_suffix) items = request(path_suffix).response.body_data items = yield(items) if block_given? items.map { |e| child_entity(entity_class, e) } end |