4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/makeplans_sms_pricing/import.rb', line 4
def teletopia(provider, url, currency)
require "json"
require "countries"
response = Net::HTTP.get_response(URI.parse(url))
json = response.body
rows = JSON.parse(json)
rows.each do |row|
country_name = row["country"].strip
country = ISO3166::Country.find_country_by_any_name(country_name)
unless country.nil?
country_code = country.alpha2
price = row["price"][currency]["standard"]
MakeplansSmsPricing.import(provider, country_code, currency, price)
end
end
end
|