module PlayStoreInfo
Constants
- FIRST_ID_REGEXP_MATCH
- MIN_IDS_REGEXP_MATCHES
- VERSION
Public Class Methods
read(id, lang = 'en')
click to toggle source
# 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)
click to toggle source
# 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
Private Class Methods
google_store?(url)
click to toggle source
# File lib/play_store_info.rb, line 35 def google_store?(url) url.match(%r{\Ahttps://play.google.com}) end
parse(id, url)
click to toggle source
# File lib/play_store_info.rb, line 25 def parse(id, url) inspector ||= MetaInspector.new(url) raise AppNotFound unless inspector.response.status == 200 AppParser.new(id, inspector.parsed) rescue Faraday::ConnectionFailed, Faraday::SSLError, Errno::ETIMEDOUT raise ConnectionError end