Class: Oos4ruby::Oos

Inherits:
Object
  • Object
show all
Defined in:
lib/oos4ruby/oos.rb

Instance Method Summary collapse

Instance Method Details

#auth_app(app_token, secret_key) ⇒ Object



7
8
9
# File 'lib/oos4ruby/oos.rb', line 7

def auth_app(app_token, secret_key)
  @auth = Auth.new(app_token, secret_key, :app)
end

#auth_user(email, api_token) ⇒ Object



11
12
13
14
# File 'lib/oos4ruby/oos.rb', line 11

def auth_user(email, api_token)
  @auth = Auth.new(email, api_token, :wsse)
  document_service
end

#privacy_catsObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/oos4ruby/oos.rb', line 24

def privacy_cats
  return @privacy_cats if @privacy_cats
  getter = HTTPInvoker.new PRIVACY_URL, @auth
  
  worked = getter.get
  
  if worked
    @privacy_cats = {}
    cats = REXML::Document.new( getter.body ).root
    REXML::XPath.match(cats, './atom:category', XmlNamespaces).each { |cat|          
      cat.add_attribute('scheme', cats.attributes['scheme'])
      @privacy_cats[cat.attributes['term'].underscore.to_sym] = Category.new(cat)
    }
  end
  return @privacy_cats
end

#search(opts) ⇒ Object



20
21
22
# File 'lib/oos4ruby/oos.rb', line 20

def search(opts)
  Search.find @auth, opts
end

#user(slug = nil) ⇒ Object



16
17
18
# File 'lib/oos4ruby/oos.rb', line 16

def user(slug = nil)      
  User.find( @auth, slug )
end