Class: RestfulObjects::CollectionDescription
- Inherits:
-
Object
- Object
- RestfulObjects::CollectionDescription
- Includes:
- LinkGenerator
- Defined in:
- lib/restful_objects/domain_model/types/collection_description.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#disabled_reason ⇒ Object
Returns the value of attribute disabled_reason.
-
#friendly_name ⇒ Object
Returns the value of attribute friendly_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#member_order ⇒ Object
Returns the value of attribute member_order.
-
#plural_form ⇒ Object
Returns the value of attribute plural_form.
-
#read_only ⇒ Object
readonly
Returns the value of attribute read_only.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #get_representation ⇒ Object
-
#initialize(id, type, domain_type, options = {}) ⇒ CollectionDescription
constructor
A new instance of CollectionDescription.
- #metadata ⇒ Object
Methods included from LinkGenerator
#generate_rel, #generate_repr_type, #link_to, #underscore_to_hyphen_string
Constructor Details
#initialize(id, type, domain_type, options = {}) ⇒ CollectionDescription
Returns a new instance of CollectionDescription.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 7 def initialize(id, type, domain_type, = {}) @id = id @type = type @domain_type = domain_type @read_only = [:read_only].nil? ? false : [:read_only] @disabled_reason = [:disabled_reason] || 'read only collection' if read_only @friendly_name = [:friendly_name] || id @description = [:description] || id @plural_form = [:plural_form] @member_order = [:member_order] end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 5 def description @description end |
#disabled_reason ⇒ Object
Returns the value of attribute disabled_reason.
5 6 7 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 5 def disabled_reason @disabled_reason end |
#friendly_name ⇒ Object
Returns the value of attribute friendly_name.
5 6 7 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 5 def friendly_name @friendly_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 4 def id @id end |
#member_order ⇒ Object
Returns the value of attribute member_order.
5 6 7 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 5 def member_order @member_order end |
#plural_form ⇒ Object
Returns the value of attribute plural_form.
5 6 7 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 5 def plural_form @plural_form end |
#read_only ⇒ Object (readonly)
Returns the value of attribute read_only.
4 5 6 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 4 def read_only @read_only end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 4 def type @type end |
Instance Method Details
#get_representation ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 19 def get_representation representation = { 'id' => id, 'memberOrder' => member_order, 'links' => [ link_to(:self, "/domain-types/#{@domain_type}/collections/#{@id}", :collection_description), link_to(:up, "/domain-types/#{@domain_type}", :domain_type), link_to(:return_type, "/domain-types/list", :domain_type), link_to(:element_type, "/domain-types/#{@type}", :domain_type) ], 'extensions' => } representation['friendlyName'] = friendly_name if friendly_name representation['description'] = description if description representation.to_json end |
#metadata ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/restful_objects/domain_model/types/collection_description.rb', line 38 def { 'friendlyName' => friendly_name, 'description' => description, 'returnType' => 'list', 'elementType' => type, 'memberOrder' => member_order, 'pluralForm' => plural_form } end |