Class: GoogleSpreadsheets::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/google_spreadsheets/base.rb

Direct Known Subclasses

List, Spreadsheet, Worksheet

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.collection_path(prefix_options = {}, query_options = nil) ⇒ Object



22
23
24
25
# File 'lib/google_spreadsheets/base.rb', line 22

def collection_path(prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "/feeds/#{collection_name}#{prefix(prefix_options)}#{query_string(query_options)}"
end

.connection(refresh = false) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/google_spreadsheets/base.rb', line 7

def connection(refresh = false)
  if defined?(@connection) || self == Base
    @connection = Connection.new(site, format) if refresh || @connection.nil?
    @connection.user = user if user
    @connection.password = password if password
    @connection.timeout = timeout if timeout
    @connection
  else
    superclass.connection
  end
end

.custom_method_collection_url(method_name, options = {}) ⇒ Object

Raises:



26
# File 'lib/google_spreadsheets/base.rb', line 26

def custom_method_collection_url(method_name, options = {}) raise NotSupportedError.new end

.delete(id, options = {}) ⇒ Object

Raises:



27
# File 'lib/google_spreadsheets/base.rb', line 27

def delete(id, options = {})  raise NotSupportedError.new end

.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object



18
19
20
21
# File 'lib/google_spreadsheets/base.rb', line 18

def element_path(id, prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "/feeds/#{collection_name}#{prefix(prefix_options)}#{id}#{query_string(query_options)}"
end

.exists?(id, options = {}) ⇒ Boolean

Returns:

  • (Boolean)

Raises:



28
# File 'lib/google_spreadsheets/base.rb', line 28

def exists?(id, options = {}) raise NotSupportedError.new end

Instance Method Details

#custom_method_element_url(method_name, options = {}) ⇒ Object

Raises:



31
# File 'lib/google_spreadsheets/base.rb', line 31

def custom_method_element_url(method_name, options = {})     raise NotSupportedError.new end

#custom_method_new_element_url(method_name, options = {}) ⇒ Object

Raises:



32
# File 'lib/google_spreadsheets/base.rb', line 32

def custom_method_new_element_url(method_name, options = {}) raise NotSupportedError.new end

#destroy ⇒ Object



34
# File 'lib/google_spreadsheets/base.rb', line 34

def destroy() connection.delete(edit_path, self.class.headers) end

#encode(options = {}) ⇒ Object



38
39
40
# File 'lib/google_spreadsheets/base.rb', line 38

def encode(options={})
  self.class.format.encode(attributes, {:root => self.class.element_name}.merge(options))
end