Class: GDocsAPIWrapper::Client::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/gdocsapi-wrapper/client/service.rb

Constant Summary collapse

@@base_uri =
'https://docs.google.com'
@@documents =
'/feeds/documents/private/full'
@@folders =
'/feeds/documents/private/full/-/folder?showfolders=true'

Class Method Summary collapse

Class Method Details

.get(object, options = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/gdocsapi-wrapper/client/service.rb', line 30

def self.get(object, options = {})
  case object
  when :documents
    uri = @@base_uri + @@documents
    
    # process types
    case options[:type]
    when :word
      uri += '/-/document'
    when :spreadsheet
      uri += '/-/spreadsheet'
    when :presentation
      uri += '/-/presentation'
    end
    
    #process filters
    case options[:filter]
    when :starred
      if options[:type] == :all
        uri += '/-'
      end
      uri += '/starred'
    when :trashed
      if options[:type] == :all
        uri += '/-'
      end
      uri += '/trashed'
    end
    return uri
    
  when :folders
    return @@base_uri + '/feeds/documents/private/full/-/folder?showfolders=true'
  else
    raise ServiceNotFoundError.new
  end
end