Module: Peekapp::Apps

Defined in:
lib/peekapp/apps.rb

Class Method Summary collapse

Class Method Details

.find(id) ⇒ Object

}}}

Raises:

  • (AppNotFound)


10
11
12
13
14
# File 'lib/peekapp/apps.rb', line 10

def self.find id # {{{
  result = JSON.parse(Peekapp::query :url => $peekapp_config[:app_url], :app_id => id)
  raise AppNotFound if result["resultCount"] < 1
  result["results"].map{ |a| App.new a }.first
end

.search(query) ⇒ Object

{{{



5
6
7
8
# File 'lib/peekapp/apps.rb', line 5

def self.search query # {{{
  result = JSON.parse(Peekapp::query(:url => $peekapp_config[:search_url], :keywords => query.gsub(' ', '%20')))
  result['results'].map { |a| App.new a }
end