Module: Peekapp

Defined in:
lib/peekapp/apps.rb,
lib/peekapp/base.rb,
lib/peekapp/ratings.rb,
lib/peekapp/reviews.rb,
lib/peekapp/version.rb

Defined Under Namespace

Modules: Apps, Ratings, Reviews Classes: App, Rating, Review

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.load_exceptionsObject

}}}



19
20
21
22
# File 'lib/peekapp/base.rb', line 19

def self.load_exceptions # {{{
  exceptions = YAML::load(File.open("#{File.dirname(__FILE__)}/config/exceptions.yml"))
  exceptions.each { |error| self.module_eval("#{error} = Class.new(StandardError)") }
end

.parse_url(data) ⇒ Object

}}}



13
14
15
16
17
# File 'lib/peekapp/base.rb', line 13

def self.parse_url data # {{{
  url = data[:url]
  data.each_pair{|k,v| url = url.gsub("|#{k}|", v.to_s) if k != :url}
  url
end

.query(args) ⇒ Object

{{{



5
6
7
8
9
10
11
# File 'lib/peekapp/base.rb', line 5

def self.query args # {{{
  c = Curl::Easy.perform(parse_url(args)) do |request|
    request.headers["User-Agent"] = $peekapp_config[:user_agent]
    request.headers["X-Apple-Store-Front"] = args[:store_id] if args[:store_id]
  end
  c.body_str
end