Class: CMSBinding::Category

Inherits:
Base
  • Object
show all
Defined in:
lib/twm-cms-bindings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#get_text

Constructor Details

#initialize(topCategory, source, partial) ⇒ Category



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/twm-cms-bindings.rb', line 38

def initialize (topCategory, source, partial)
  @source = source;
  @articles = []
  @sub_categories = []
  @partial = partial
  
  @id = topCategory.attributes['id'].to_str
  @name = get_text( REXML::XPath.first( topCategory, "name" ) )
  @description = get_text( REXML::XPath.first( topCategory, "description" ) )
  @category_weblink = get_text( REXML::XPath.first( topCategory, "category_weblink" ) )
  @article_weblink = get_text( REXML::XPath.first( topCategory, "article_weblink" ) )
  
  if ( partial == false)
    @cdn_image_url = get_text( REXML::XPath.first( topCategory, "cdn_image_url" ) )
  
    @cdn_thumbnail_url = get_text( REXML::XPath.first( topCategory, "cdn_thumbnail_url" ) )
    REXML::XPath.each( topCategory, "subcategories/category") {|subCategory|
      @sub_categories << CMSBinding::Category.new( subCategory, source, true )
    }
    
    REXML::XPath.each( topCategory, "articles/article" ) {|article|
      @articles << CMSBinding::Article.new( article, source, true )
    }
  end
end

Instance Attribute Details

#article_weblinkObject (readonly)

Returns the value of attribute article_weblink.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def article_weblink
  @article_weblink
end

#articlesObject (readonly)

Returns the value of attribute articles.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def articles
  @articles
end

Returns the value of attribute category_weblink.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def category_weblink
  @category_weblink
end

#cdn_image_urlObject (readonly)

Returns the value of attribute cdn_image_url.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def cdn_image_url
  @cdn_image_url
end

#cdn_thumbnail_urlObject (readonly)

Returns the value of attribute cdn_thumbnail_url.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def cdn_thumbnail_url
  @cdn_thumbnail_url
end

#descriptionObject (readonly)

Returns the value of attribute description.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def parent
  @parent
end

#sub_categoriesObject (readonly)

Returns the value of attribute sub_categories.



34
35
36
# File 'lib/twm-cms-bindings.rb', line 34

def sub_categories
  @sub_categories
end