Class: Java::ComGoogleGdataClient::GoogleService

Inherits:
Object
  • Object
show all
Includes:
GoogleHelpers
Defined in:
lib/google_service.rb

Instance Method Summary collapse

Methods included from GoogleHelpers

#update_attributes, #url_for

Instance Method Details

#auth_sub_token=(options) ⇒ Object



8
9
10
11
# File 'lib/google_service.rb', line 8

def auth_sub_token=(options)
  options = {:private_key => nil}.merge(options)
  self.set_auth_sub_token(options[:token], options[:private_key])
end

#create_batch(options = {}) ⇒ Object



67
68
69
70
71
72
73
74
75
# File 'lib/google_service.rb', line 67

def create_batch(options={})
  raise "Feed URL is required" unless options[:url]
  raise "Feed is required" unless options[:feed]
  options[:url] = url_for(options[:url]) if options[:url]
  
  batch(options[:url], options[:feed])
rescue NativeException => e
  raise GData.gdata_exception_for(e)
end

#create_entry(options = {}) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/google_service.rb', line 51

def create_entry(options={})
  raise "Feed URL is required" unless options[:url]
  raise "Entry is required" unless options[:entry]
  options[:url] = url_for(options[:url]) if options[:url]
  insert(options[:url], options[:entry])
rescue NativeException => e
  raise GData.gdata_exception_for(e)
end

#delete_entry(options = {}) ⇒ Object



60
61
62
63
64
65
# File 'lib/google_service.rb', line 60

def delete_entry(options={})
  raise "Entry URL is required" unless options[:url]
  options[:url] = url_for(options[:url]) if options[:url]
  
  delete(options[:url])
end

#find_entry(options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/google_service.rb', line 32

def find_entry(options={})
  raise "URL or query is required" unless options[:url] or option[:query]
  raise "Entry Class is required" unless options[:class]
  options[:url] = url_for(options[:url]) if options[:url]
  
  begin
    if options[:etag] or options[:modified_since]
      get_entry(options[:url] || options[:query], 
        options[:class].java_class, 
        options[:etag] || options[:modified_since])
    else
      get_entry(options[:url] || options[:query], 
        options[:class].java_class)
    end
  rescue NativeException => e
    raise GData.gdata_exception_for(e)
  end
end

#find_feed(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/google_service.rb', line 13

def find_feed(options={})
  raise "URL or query is required" unless options[:url] or options[:query]
  raise "Feed Class is required" unless options[:class]
  options[:url] = url_for(options[:url]) if options[:url]
  
  begin
    if options[:etag] or options[:modified_since]
      get_feed(options[:url] || options[:query], 
        options[:class].java_class, 
        options[:etag] || options[:modified_since])
    else
      get_feed(options[:url] || options[:query], 
        options[:class].java_class)
    end
  rescue NativeException => e
    raise GData.gdata_exception_for(e)
  end
end

#oauth_credentials=(credientials, signer = GData::OAuthHmacSha1Signer.new) ⇒ Object



4
5
6
# File 'lib/google_service.rb', line 4

def oauth_credentials=(credientials, signer=GData::OAuthHmacSha1Signer.new)
  self.set_oauth_credentials(credientials, signer)
end