We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ce0873b commit dfa8155Copy full SHA for dfa8155
2 files changed
lib/contentstack/entries.rb
@@ -8,11 +8,12 @@ class Entries
8
9
def initialize(body)
10
@body = body
11
- @entries = body.map { |entry| Entry.new(entry) }
12
end
13
14
def each(&block)
15
- entries.each(&block)
+ @body.each do |entry|
+ block.call(Entry.new(entry))
16
+ end
17
18
19
lib/contentstack/entry.rb
@@ -2,13 +2,22 @@
2
3
module Contentstack
4
class Entry
5
+
6
+ attr_reader :properties, :attributes
7
def initialize(attributes)
@attributes = attributes
+ @properties = attributes.keys
+ properties.each do |prop|
+ define_singleton_method prop do
+ @attributes[prop]
- def properties
- @attributes.keys
+ def to_s
20
+ "#{attributes[:title]} created on #{attributes[:created_at]}"
21
22
23
def is_entry?
0 commit comments