Module: Contentful::Resource::SystemProperties
- Included in:
- Array, Asset, ContentType, DeletedAsset, DeletedEntry, Entry, Link, Space, SyncPage
- Defined in:
- lib/contentful/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.
16 17 18 |
# File 'lib/contentful/resource/system_properties.rb', line 16 def sys @sys end |
Class Method Details
.included(base) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/contentful/resource/system_properties.rb', line 37 def self.included(base) base.extend(ClassMethods) base.sys_coercions.keys.each do |name| base.send :define_method, Contentful::Support.snakify(name) do sys[name.to_sym] end end end |
Instance Method Details
#initialize(object) ⇒ Object
18 19 20 21 |
# File 'lib/contentful/resource/system_properties.rb', line 18 def initialize(object, *) super @sys = extract_from_object object['sys'], :sys end |
#inspect(info = nil) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/contentful/resource/system_properties.rb', line 23 def inspect(info = nil) if sys.empty? super(info) else super("#{info} @sys=#{sys.inspect}") end end |