class Android::Publisher::Edit

Constants

ENDPOINT

Attributes

client[R]
id[R]

Public Class Methods

new(connection, version_code) click to toggle source
# File lib/android/publisher/edit.rb, line 6
def initialize(connection, version_code)
  @client       = connection.add_endpoint(ENDPOINT)
  @version_code = version_code
end

Public Instance Methods

assign_to_alpha_track() click to toggle source
# File lib/android/publisher/edit.rb, line 50
def assign_to_alpha_track
  Track.new(@client, :alpha).update(version_code)
end
assign_to_beta_track() click to toggle source
# File lib/android/publisher/edit.rb, line 54
def assign_to_beta_track
  Track.new(@client, :beta).update(version_code)
end
assign_to_production_track() click to toggle source
# File lib/android/publisher/edit.rb, line 58
def assign_to_production_track
  Track.new(@client, :production).update(version_code)
end
assign_to_staged_rollout_track(user_fraction) click to toggle source
# File lib/android/publisher/edit.rb, line 62
def assign_to_staged_rollout_track(user_fraction)
  Track.new(@client, :rollout).update(version_code, user_fraction)
end
clear_beta() click to toggle source
# File lib/android/publisher/edit.rb, line 74
def clear_beta
  Track.new(@client, :beta).update(nil)
end
clear_rollout() click to toggle source
# File lib/android/publisher/edit.rb, line 70
def clear_rollout
  Track.new(@client, :rollout).update(nil)
end
commit() click to toggle source
# File lib/android/publisher/edit.rb, line 22
def commit
  response = connection.commit
  reset_status
  response
end
delete() click to toggle source
# File lib/android/publisher/edit.rb, line 28
def delete
  if (id)
    response = Response.parse(@client.delete)
    reset_status
    response
  else
    raise "Edit is not created, please insert one"
  end
end
get() click to toggle source
# File lib/android/publisher/edit.rb, line 18
def get
  Response.parse(@client.get)
end
insert() click to toggle source
# File lib/android/publisher/edit.rb, line 11
def insert
  response  = Response.parse(@client.post)
  @id       = response['id']
  @client   = @client.add_endpoint(id)
  response
end
rollout_fraction() click to toggle source
# File lib/android/publisher/edit.rb, line 42
def rollout_fraction
  Track.new(@client, :rollout).rollout_fraction
end
track_has_deployed_apks?(track) click to toggle source
# File lib/android/publisher/edit.rb, line 38
def track_has_deployed_apks?(track)
  Track.new(@client, track).has_deployed_apks?
end
update_rollout(user_fraction) click to toggle source
# File lib/android/publisher/edit.rb, line 66
def update_rollout(user_fraction)
  Track.new(@client, :rollout).patch(version_code, user_fraction)
end
upload_apk(path_to_apk) click to toggle source
# File lib/android/publisher/edit.rb, line 46
def upload_apk(path_to_apk)
  apks.upload(path_to_apk)
end

Private Instance Methods

apk_latest_version_code() click to toggle source
# File lib/android/publisher/edit.rb, line 90
def apk_latest_version_code
  apks.list['apks'].last['versionCode']
end
apks() click to toggle source
# File lib/android/publisher/edit.rb, line 86
def apks
  Apks.new(@client)
end
connection() click to toggle source
# File lib/android/publisher/edit.rb, line 98
def connection
  @connection ||= Android::Publisher::EditConnection.new(@client, @id)
end
reset_status() click to toggle source
# File lib/android/publisher/edit.rb, line 81
def reset_status
  @client = @client.remove_endpoint
  @id     = nil
end
version_code() click to toggle source
# File lib/android/publisher/edit.rb, line 94
def version_code
  @version_code || apk_latest_version_code
end