Module: CDG::Services
- Defined in:
- lib/cdg/version.rb,
lib/cdg/services.rb,
lib/cdg/services/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.GetAndroidVersion(app_id:) ⇒ Object
eg sg.codigo.app_name.
-
.GetIOSVersion(app_id:) ⇒ Object
eg 123456789.
Class Method Details
.GetAndroidVersion(app_id:) ⇒ Object
eg sg.codigo.app_name
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cdg/services.rb', line 23 def self.GetAndroidVersion app_id: # eg sg.codigo.app_name begin resp = Nokogiri::HTML(open("https://play.google.com/store/apps/details?id=#{ app_id }&hl=en")) elements = resp.css("div[class='content'][itemprop='softwareVersion']") if elements.empty? nil else elements[0].text.strip end rescue OpenURI::HTTPError => e return nil end end |
.GetIOSVersion(app_id:) ⇒ Object
eg 123456789
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cdg/services.rb', line 12 def self.GetIOSVersion app_id: # eg 123456789 resp = JSON.parse Net::HTTP.get(URI("https://itunes.apple.com/lookup?id=#{app_id}")) results = resp["results"] if results.empty? nil else results[0]["version"] end end |