Class: Tumblargh::Resource::Blog
- Defined in:
- lib/tumblargh/resource/blog.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
Attributes inherited from Base
Instance Method Summary collapse
- #attributes=(attrs) ⇒ Object
- #fetch ⇒ Object
- #fetch! ⇒ Object
-
#initialize(domain, attrs = nil) ⇒ Blog
constructor
A new instance of Blog.
- #posts ⇒ Object
- #posts=(ary) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(domain, attrs = nil) ⇒ Blog
Returns a new instance of Blog.
8 9 10 11 |
# File 'lib/tumblargh/resource/blog.rb', line 8 def initialize(domain, attrs=nil) @domain = domain self.attributes = attrs.nil? ? fetch : attrs end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tumblargh::Resource::Base
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
6 7 8 |
# File 'lib/tumblargh/resource/blog.rb', line 6 def domain @domain end |
Instance Method Details
#attributes=(attrs) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tumblargh/resource/blog.rb', line 13 def attributes=(attrs) attrs = attrs.with_indifferent_access # We passed in result from /posts, or a local file if attrs.include?(:posts) && attrs.include?(:blog) self.posts = attrs[:posts] attrs.delete(:posts) self.attributes = attrs[:blog] else super(attrs) end @attributes end |
#fetch ⇒ Object
29 30 31 |
# File 'lib/tumblargh/resource/blog.rb', line 29 def fetch API.blog(domain) end |
#fetch! ⇒ Object
33 34 35 |
# File 'lib/tumblargh/resource/blog.rb', line 33 def fetch! self.attributes = fetch end |