Module: Contentful::Management::Resource::SystemProperties
- Defined in:
- lib/contentful/management/resource/system_properties.rb
Overview
Adds the feature to have system properties to a Resource.
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- SYS_COERCIONS =
{ type: :string, id: :string, space: nil, contentType: nil, linkType: :string, revision: :integer, createdAt: :date, updatedAt: :date, locale: :string }
Instance Attribute Summary collapse
-
#sys ⇒ Object
readonly
Returns the value of attribute sys.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#sys ⇒ Object (readonly)
Returns the value of attribute sys.
17 18 19 |
# File 'lib/contentful/management/resource/system_properties.rb', line 17 def sys @sys end |
Class Method Details
.included(base) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/contentful/management/resource/system_properties.rb', line 39 def self.included(base) base.extend(ClassMethods) base.sys_coercions.keys.each { |name| accessor_name = Contentful::Management::Support.snakify(name) base.send :define_method, accessor_name do sys[name.to_sym] end base.send :define_method, "#{ accessor_name }=" do |value| sys[name.to_sym] = value end } end |
Instance Method Details
#initialize(object = {'sys' => nil}) ⇒ Object
19 20 21 22 23 |
# File 'lib/contentful/management/resource/system_properties.rb', line 19 def initialize(object = {'sys' => nil}, *) super object ||= {'sys' => nil} @sys = extract_from_object object['sys'], :sys end |
#inspect(info = nil) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/contentful/management/resource/system_properties.rb', line 25 def inspect(info = nil) if sys.empty? super(info) else super("#{ info } @sys=#{ sys.inspect }") end end |