Class: Garb::Management::Segment
- Inherits:
-
Object
- Object
- Garb::Management::Segment
- Defined in:
- lib/garb/management/segment.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#session ⇒ Object
Returns the value of attribute session.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition.
5 6 7 |
# File 'lib/garb/management/segment.rb', line 5 def definition @definition end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/garb/management/segment.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/garb/management/segment.rb', line 5 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/garb/management/segment.rb', line 4 def path @path end |
#session ⇒ Object
Returns the value of attribute session.
4 5 6 |
# File 'lib/garb/management/segment.rb', line 4 def session @session end |
Class Method Details
.all(session = Session) ⇒ Object
7 8 9 10 |
# File 'lib/garb/management/segment.rb', line 7 def self.all(session = Session) feed = Feed.new(session, '/segments') feed.entries.map {|entry| new_from_entry(entry, session)} end |
.new_from_entry(entry, session) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/garb/management/segment.rb', line 12 def self.new_from_entry(entry, session) segment = new segment.session = session segment.path = Garb.parse_link(entry, "self").gsub(Feed::BASE_URL, '') segment.properties = entry['dxp:segment'] segment end |
Instance Method Details
#properties=(properties) ⇒ Object
20 21 22 23 24 |
# File 'lib/garb/management/segment.rb', line 20 def properties=(properties) self.id = properties['id'] self.name = properties['name'] self.definition = properties['dxp:definition'] end |