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



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

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])
end

#create_entry(options = {}) ⇒ Object



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

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])
end

#delete_entry(options = {}) ⇒ Object



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

def delete_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]
  
  delete(options[:url], options[:entry])
end

#find_entry(options = {}) ⇒ Object



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

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
    return nil if e.message =~ /NotFound/
    raise 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
31
# 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
    return nil if e.message =~ /NotFound/
    raise 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