Module: PlayStoreInfo

Defined in:
lib/play_store_info.rb,
lib/play_store_info/errors.rb,
lib/play_store_info/readers.rb,
lib/play_store_info/version.rb,
lib/play_store_info/app_parser.rb

Defined Under Namespace

Modules: Readers Classes: AppNotFound, AppParser, ConnectionError, GenericError, InvalidStoreLink

Constant Summary collapse

MIN_IDS_REGEXP_MATCHES =
2
FIRST_ID_REGEXP_MATCH =
1
VERSION =
'1.0.2'.freeze

Class Method Summary collapse

Class Method Details

.read(id, lang = 'en') ⇒ Object



11
12
13
# File 'lib/play_store_info.rb', line 11

def read(id, lang = 'en')
  parse(id, "https://play.google.com/store/apps/details?id=#{id}&hl=#{lang}")
end

.read_url(url) ⇒ Object

Raises:



15
16
17
18
19
20
21
# File 'lib/play_store_info.rb', line 15

def read_url(url)
  id = url.match(/id=([[:alnum:]\.]+)[&]?/)

  raise InvalidStoreLink unless google_store?(url) && id && id.length == MIN_IDS_REGEXP_MATCHES

  parse(id[FIRST_ID_REGEXP_MATCH], url)
end