Class: Android::Publisher::Edit

Inherits:
Object
  • Object
show all
Defined in:
lib/android/publisher/edit.rb

Constant Summary collapse

ENDPOINT =
"edits"

Instance Method Summary collapse

Constructor Details

#initialize(connection, version_code) ⇒ Edit

Returns a new instance of Edit.



6
7
8
9
# File 'lib/android/publisher/edit.rb', line 6

def initialize(connection, version_code)
  @client       = connection.add_endpoint(ENDPOINT)
  @version_code = version_code
end

Instance Method Details

#assign_to_alpha_trackObject



46
47
48
# File 'lib/android/publisher/edit.rb', line 46

def assign_to_alpha_track
  Track.new(@client, :alpha).update(version_code)
end

#assign_to_beta_trackObject



50
51
52
# File 'lib/android/publisher/edit.rb', line 50

def assign_to_beta_track
  Track.new(@client, :beta).update(version_code)
end

#assign_to_production_trackObject



54
55
56
# File 'lib/android/publisher/edit.rb', line 54

def assign_to_production_track
  Track.new(@client, :production).update(version_code)
end

#assign_to_staged_rollout_track(user_fraction) ⇒ Object



58
59
60
# File 'lib/android/publisher/edit.rb', line 58

def assign_to_staged_rollout_track(user_fraction)
  Track.new(@client, :rollout).update(version_code, user_fraction)
end

#clear_betaObject



70
71
72
# File 'lib/android/publisher/edit.rb', line 70

def clear_beta
  Track.new(@client, :beta).update(nil)
end

#clear_rolloutObject



66
67
68
# File 'lib/android/publisher/edit.rb', line 66

def clear_rollout
  Track.new(@client, :rollout).update(nil)
end

#commitObject



22
23
24
25
26
# File 'lib/android/publisher/edit.rb', line 22

def commit
  response = connection.commit
  reset_status
  response
end

#deleteObject



28
29
30
31
32
33
34
35
36
# 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

#getObject



18
19
20
# File 'lib/android/publisher/edit.rb', line 18

def get
  Response.parse(@client.get)
end

#insertObject



11
12
13
14
15
16
# 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

#track_has_deployed_apks?(track) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# 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) ⇒ Object



62
63
64
# File 'lib/android/publisher/edit.rb', line 62

def update_rollout(user_fraction)
  Track.new(@client, :rollout).patch(version_code, user_fraction)
end

#upload_apk(path_to_apk) ⇒ Object



42
43
44
# File 'lib/android/publisher/edit.rb', line 42

def upload_apk(path_to_apk)
  apks.upload(path_to_apk)
end