Class: GDocs4Ruby::Presentation
- Inherits:
-
Document
- Object
- GData4Ruby::GDataObject
- BaseObject
- Document
- GDocs4Ruby::Presentation
- Defined in:
- lib/gdocs4ruby/presentation.rb
Overview
The Presentation class represents a Google Presentation. Also check out Document and BaseObject, the superclass of Presentation.
Usage
All usages assume you’ve already authenticated with the service, and have a service object called
-
Create a new Presentation p = Presentation.new(@service) p.title = ‘Test Presentation’ p.local_file = ‘/path/to/some/spreadsheet.ppt’ p.save
-
Deleting a Presentation p = Presentation.find(@service, => @doc_id) p.delete
-
Finding an existing Presentation by id p = Presentation.find(@service, => @doc_id)
-
Full Text Query p = Presentation.find(@service, ‘content text’)
or
p = Presentation.find(@service, {:query => 'content text'})
-
Finding an Existing Spreadsheet by Title p = Presentation.find(@service, nil, => ‘Test Presentation’)
-
Retrieving an Export p = Presentation.find(@service, => @doc_id) p.download_to_file(‘pdf’, ‘/path/to/save/location.pdf’)
Constant Summary collapse
- DOCUMENT_XML =
'<?xml version="1.0" encoding="UTF-8"?> <atom:entry xmlns:atom="http://www.w3.org/2005/Atom"> <atom:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/docs/2007#spreadsheet" label="presentation"/> <atom:title></atom:title> </atom:entry>'
- DOWNLOAD_TYPES =
['pdf', 'png', 'ppt', 'swf', 'txt']
- EXPORT_URI =
'http://docs.google.com/feeds/download/presentations/Export'
Constants inherited from BaseObject
BaseObject::BOUNDARY, BaseObject::ENTRY_XML, BaseObject::FEEDS, BaseObject::QUERY_FEEDS, BaseObject::TYPES, BaseObject::UPLOAD_TYPES
Instance Attribute Summary
Attributes inherited from BaseObject
#bytes_used, #folders, #html_uri, #local_file, #type, #viewed
Class Method Summary collapse
-
.find(service, query, args = {}) ⇒ Object
Helper function limit queries to Presentations.
Instance Method Summary collapse
-
#get_content(type) ⇒ Object
Retrieves an export of the Presentation.
-
#initialize(service, attributes = {}) ⇒ Presentation
constructor
Creates a new Presentation instance.
Methods inherited from Document
Methods inherited from BaseObject
#access_rules, #add_access_rule, #add_to_folder, #content=, #content_type=, #create, #load, #put_content, #remove_access_rule, #remove_from_folder, #save, #to_iframe, #update_access_rule
Constructor Details
#initialize(service, attributes = {}) ⇒ Presentation
Creates a new Presentation instance. Requires a valid Service object.
66 67 68 69 |
# File 'lib/gdocs4ruby/presentation.rb', line 66 def initialize(service, attributes = {}) super(service, attributes) @xml = DOCUMENT_XML end |
Class Method Details
.find(service, query, args = {}) ⇒ Object
Helper function limit queries to Presentations. See BaseObject::find for syntax. Type is not required and assumed to be ‘presentation’.
61 62 63 |
# File 'lib/gdocs4ruby/presentation.rb', line 61 def self.find(service, query, args = {}) BaseObject::find(service, query, 'presentation', args) end |
Instance Method Details
#get_content(type) ⇒ Object
Retrieves an export of the Presentation. The parameter type
must be one of the DOWNLOAD_TYPES
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/gdocs4ruby/presentation.rb', line 72 def get_content(type) if !@exists raise DocumentDoesntExist end if not DOWNLOAD_TYPES.include? type raise ArgumentError end ret = service.send_request(GData4Ruby::Request.new(:get, EXPORT_URI, nil, nil, {"docID" => @id,"exportFormat" => type})) ret.body end |