Class: Postal::Content
- Inherits:
-
Object
- Object
- Postal::Content
- Defined in:
- lib/postal/content.rb
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
{:content_id => nil, :date_created => nil, :description => nil, :doc_parts => nil, :doc_type => nil, :header_from => nil, :header_to => nil, :is_read_only => nil, :is_template => nil, :list_name => nil, :native_title => nil, :site_name => nil, :title => nil}
Instance Attribute Summary collapse
-
#content_id ⇒ Object
Returns the value of attribute content_id.
-
#date_created ⇒ Object
Returns the value of attribute date_created.
-
#description ⇒ Object
Returns the value of attribute description.
-
#doc_parts ⇒ Object
Returns the value of attribute doc_parts.
-
#doc_type ⇒ Object
Returns the value of attribute doc_type.
-
#header_from ⇒ Object
Returns the value of attribute header_from.
-
#header_to ⇒ Object
Returns the value of attribute header_to.
-
#is_read_only ⇒ Object
Returns the value of attribute is_read_only.
-
#is_template ⇒ Object
Returns the value of attribute is_template.
-
#list_name ⇒ Object
Returns the value of attribute list_name.
-
#native_title ⇒ Object
Returns the value of attribute native_title.
-
#site_name ⇒ Object
Returns the value of attribute site_name.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.find_all ⇒ Object
really just an alias for find_by_filter but with no options.
- .find_by_filter(*args) ⇒ Object
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Content
constructor
Create a new member instance.
Constructor Details
#initialize(attributes = {}) ⇒ Content
Create a new member instance
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/postal/content.rb', line 63 def initialize(attributes={}) attributes = DEFAULT_ATTRIBUTES.merge(attributes) @content_id = attributes[:content_id] @date_created = attributes[:date_created] @description = attributes[:description] @doc_parts = attributes[:doc_parts] @doc_type = attributes[:doc_type] @header_from = attributes[:header_from] @header_to = attributes[:header_to] @is_read_only = attributes[:is_read_only] @is_template = attributes[:is_template] @list_name = attributes[:list_name] @native_title = attributes[:native_title] @site_name = attributes[:site_name] @title = attributes[:title] end |
Instance Attribute Details
#content_id ⇒ Object
Returns the value of attribute content_id.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def content_id @content_id end |
#date_created ⇒ Object
Returns the value of attribute date_created.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def date_created @date_created end |
#description ⇒ Object
Returns the value of attribute description.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def description @description end |
#doc_parts ⇒ Object
Returns the value of attribute doc_parts.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def doc_parts @doc_parts end |
#doc_type ⇒ Object
Returns the value of attribute doc_type.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def doc_type @doc_type end |
#header_from ⇒ Object
Returns the value of attribute header_from.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def header_from @header_from end |
#header_to ⇒ Object
Returns the value of attribute header_to.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def header_to @header_to end |
#is_read_only ⇒ Object
Returns the value of attribute is_read_only.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def is_read_only @is_read_only end |
#is_template ⇒ Object
Returns the value of attribute is_template.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def is_template @is_template end |
#list_name ⇒ Object
Returns the value of attribute list_name.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def list_name @list_name end |
#native_title ⇒ Object
Returns the value of attribute native_title.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def native_title @native_title end |
#site_name ⇒ Object
Returns the value of attribute site_name.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def site_name @site_name end |
#title ⇒ Object
Returns the value of attribute title.
59 60 61 |
# File 'lib/postal/content.rb', line 59 def title @title end |
Class Method Details
.find_all ⇒ Object
really just an alias for find_by_filter but with no options
38 39 40 |
# File 'lib/postal/content.rb', line 38 def find_all find_by_filter end |
.find_by_filter(*args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/postal/content.rb', line 6 def find_by_filter(*args) unless args.find { |arg| arg.match(/ListName/) } args << "ListName=#{Postal.options[:list_name]}" end if soap_contents = Postal.driver.selectContent(args)[:item] contents = soap_contents.collect do |content| Content.new(:content_id => content[:content_id], :date_created => content[:date_created], :description => content[:description], :doc_parts => content[:doc_parts], :doc_type => content[:doc_yype], :header_from => content[:header_from], :header_to => content[:header_to], :is_read_only => content[:is_read_only], :is_template => content[:is_template], :list_name => content[:list_name], :native_title => content[:native_title], :site_name => content[:site_name], :title => content[:title]) end if contents.size == 1 return contents.first else return contents end else return nil end end |