Class: TypePadTemplate::Blog
- Inherits:
-
Object
- Object
- TypePadTemplate::Blog
- Extended by:
- Forwardable
- Defined in:
- lib/type_pad_template/blog.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#blog_id ⇒ Object
readonly
Returns the value of attribute blog_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(account, blog_id, name) ⇒ Blog
constructor
A new instance of Blog.
- #templates ⇒ Object
Constructor Details
#initialize(account, blog_id, name) ⇒ Blog
Returns a new instance of Blog.
9 10 11 12 13 |
# File 'lib/type_pad_template/blog.rb', line 9 def initialize(account, blog_id, name) @account = account @blog_id = blog_id @name = name end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
7 8 9 |
# File 'lib/type_pad_template/blog.rb', line 7 def account @account end |
#blog_id ⇒ Object (readonly)
Returns the value of attribute blog_id.
7 8 9 |
# File 'lib/type_pad_template/blog.rb', line 7 def blog_id @blog_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/type_pad_template/blog.rb', line 7 def name @name end |
Instance Method Details
#templates ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/type_pad_template/blog.rb', line 15 def templates return [] unless design_id = current_design_id request("/site/blogs/#{@blog_id}/design/#{design_id}/templates") do |response| response. doc. search("//td[@class='index-templates' or @class='archive-templates' or @class='template-modules']/a[@class='link']"). map do |element| name = element.text output_file_element = element.at("../..//td[@class='output-file']") filename = if output_file_element output_file_element.text else "#{name.downcase.gsub(/[\- ]/, "_")}.template" end Template.new(self, name, filename, element["href"]) end end end |