Class: QuickBase::RSSGenerator::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/QuickBaseRSSGenerator.rb

Overview

Nested class to encapsulate RSS retrieval options for a QuickBase table.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dbid, tableName, fields, query = nil, qid = nil, qname = nil, numRecords = 0, slist = "2", options = "sortorder-D") ⇒ Table

‘tableName’ is the table name as it should appear in the output. Gets all records by default, sorted by Date Modified (“2”) in descending order. Only retrieves fields in ‘fields’ parameter. <pubDate> is set to Date Modified (“2”) by default <link> is set to Record ID# (“3”) by default any additional quickbase field can be included in ‘fields’




49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/QuickBaseRSSGenerator.rb', line 49

def initialize( dbid, tableName, fields, query = nil, qid = nil, qname = nil, numRecords = 0, slist = "2", options = "sortorder-D" )
   
   raise "fields parameter must be a Hash" if !fields.is_a?( Hash )
   
   @dbid, @tableName, @fields = dbid, tableName, fields
   @query, @qid, @qname, @numRecords, @slist, @options = query, qid, qname, numRecords, slist, options

   @fields["pubDate"] = "2" if @fields["pubDate"].nil?
   @fields["link"] = "3" if @fields["link"].nil?
   
   @optionalFields = Hash.new

   @clist = ""
   if @fields["description"] and @fields["title"]
      @fields.each{ |k,v| 
         @clist << "#{v}." 
         if k != "pubDate" and k != "link" and k != "description" and k != "title"
            @optionalFields[v] = k 
         end     
      }
      @clist[-1] = ""
   else
      raise "fields parameter must include a 'description' and 'title'" 
   end

   @title = "Default RSS Item Title"
   @link = "http://www.quickbase.com/db/main"
   @description = "Default RSS item description"
 
   @options << ".num-#{numRecords}" if numRecords > 0
end

Instance Attribute Details

#clistObject (readonly)

Returns the value of attribute clist.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def clist
  @clist
end

#dbidObject (readonly)

Returns the value of attribute dbid.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def dbid
  @dbid
end

#descriptionObject (readonly)

Returns the value of attribute description.



40
41
42
# File 'lib/QuickBaseRSSGenerator.rb', line 40

def description
  @description
end

#fieldsObject (readonly)

Returns the value of attribute fields.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def fields
  @fields
end

Returns the value of attribute link.



40
41
42
# File 'lib/QuickBaseRSSGenerator.rb', line 40

def link
  @link
end

#numRecordsObject (readonly)

Returns the value of attribute numRecords.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def numRecords
  @numRecords
end

#optionalFieldsObject (readonly)

Returns the value of attribute optionalFields.



40
41
42
# File 'lib/QuickBaseRSSGenerator.rb', line 40

def optionalFields
  @optionalFields
end

#optionsObject (readonly)

Returns the value of attribute options.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def options
  @options
end

#qidObject (readonly)

Returns the value of attribute qid.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def qid
  @qid
end

#qnameObject (readonly)

Returns the value of attribute qname.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def qname
  @qname
end

#queryObject (readonly)

Returns the value of attribute query.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def query
  @query
end

#slistObject (readonly)

Returns the value of attribute slist.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def slist
  @slist
end

#tableNameObject (readonly)

Returns the value of attribute tableName.



39
40
41
# File 'lib/QuickBaseRSSGenerator.rb', line 39

def tableName
  @tableName
end

#titleObject (readonly)

Returns the value of attribute title.



40
41
42
# File 'lib/QuickBaseRSSGenerator.rb', line 40

def title
  @title
end