Class: GsaFeeds::Base
- Inherits:
-
Object
- Object
- GsaFeeds::Base
- Defined in:
- lib/gsa_feeds/base.rb
Instance Attribute Summary collapse
-
#datasource ⇒ Object
Returns the value of attribute datasource.
-
#feedtype ⇒ Object
Returns the value of attribute feedtype.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#records ⇒ Object
(also: #to_a)
Returns the value of attribute records.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #add_record(record) ⇒ Object
- #build_record(url, options = {}, metadata = nil, content = nil) ⇒ Object
- #clear! ⇒ Object
- #commit! ⇒ Object
-
#initialize(hostname, datasource = 'web', feedtype = 'incremental', timeout = false) ⇒ Base
constructor
A new instance of Base.
- #to_xml ⇒ Object
Constructor Details
#initialize(hostname, datasource = 'web', feedtype = 'incremental', timeout = false) ⇒ Base
Returns a new instance of Base.
2 3 4 5 6 7 8 |
# File 'lib/gsa_feeds/base.rb', line 2 def initialize(hostname, datasource = 'web', feedtype = 'incremental', timeout = false) @hostname = hostname @timeout = timeout || GsaFeeds::TIMEOUT @records = [] @datasource = datasource @feedtype = feedtype end |
Instance Attribute Details
#datasource ⇒ Object
Returns the value of attribute datasource.
9 10 11 |
# File 'lib/gsa_feeds/base.rb', line 9 def datasource @datasource end |
#feedtype ⇒ Object
Returns the value of attribute feedtype.
9 10 11 |
# File 'lib/gsa_feeds/base.rb', line 9 def feedtype @feedtype end |
#hostname ⇒ Object
Returns the value of attribute hostname.
9 10 11 |
# File 'lib/gsa_feeds/base.rb', line 9 def hostname @hostname end |
#records ⇒ Object Also known as: to_a
Returns the value of attribute records.
9 10 11 |
# File 'lib/gsa_feeds/base.rb', line 9 def records @records end |
#timeout ⇒ Object
Returns the value of attribute timeout.
9 10 11 |
# File 'lib/gsa_feeds/base.rb', line 9 def timeout @timeout end |
Instance Method Details
#add_record(record) ⇒ Object
16 17 18 |
# File 'lib/gsa_feeds/base.rb', line 16 def add_record(record) @records << record end |
#build_record(url, options = {}, metadata = nil, content = nil) ⇒ Object
20 21 22 |
# File 'lib/gsa_feeds/base.rb', line 20 def build_record(url, = {}, = nil, content = nil) @records << GsaFeeds::Record.new(url, , , content) end |
#clear! ⇒ Object
12 13 14 |
# File 'lib/gsa_feeds/base.rb', line 12 def clear! @records = [] end |
#commit! ⇒ Object
24 25 26 27 28 |
# File 'lib/gsa_feeds/base.rb', line 24 def commit! push_records(@records) clear! true end |
#to_xml ⇒ Object
30 31 32 |
# File 'lib/gsa_feeds/base.rb', line 30 def to_xml build_xml(@records) end |