29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/googlepub/inapps.rb', line 29
def edit_inapp(options = {})
p "Going to Edit the In-App"
new_iap = {"packageName"=>@package, "sku"=>@sku, "status"=>options["status"] || @inapp["status"], "purchaseType"=>@inapp["purchaseType"],
"defaultPrice"=>{"priceMicros"=>options["price"] || @inapp["defaultPrice"]["priceMicros"], "currency"=>options["currency"] || @inapp["defaultPrice"]["currency"]}, "listings"=>{@language=>{"title"=>options["title"] || @inapp["listings"][@language]["title"],
"description"=>options["fullDescription"] || @inapp["listings"][@language]["description"] }}, "defaultLanguage"=>@language}
resp = HTTParty.put("https://www.googleapis.com/androidpublisher/v2/applications/#{@package}/inappproducts/#{@sku}?autoConvertMissingPrices=true&access_token=#{@access_token}", :headers => { 'Content-Type' => 'application/json' },
:body => new_iap.to_json).parsed_response
if options["title"] && resp["listings"][@language]["title"] != options["title"]
puts "Unable to Change name, Response -> #{resp}".red
exit 3
elsif options["title"] && resp["listings"][@language]["title"] == options["title"]
puts "Done: Name Change".green
end
if options["price"] && resp["defaultPrice"]["priceMicros"] != options["price"]
puts "Unable to change price, Response -> #{resp}".red
exit 3
elsif options["price"] && resp["defaultPrice"]["priceMicros"] == options["price"]
puts "Done: Price Change".green
end
end
|