Class: Spaceship::ConnectAPI::RoutingAppCoverage

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb

Instance Attribute Summary collapse

Attributes included from Model

#id, #reverse_attr_map

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes

Instance Attribute Details

#asset_delivery_stateObject

Returns the value of attribute asset_delivery_state.



14
15
16
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 14

def asset_delivery_state
  @asset_delivery_state
end

#file_nameObject

Returns the value of attribute file_name.



11
12
13
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 11

def file_name
  @file_name
end

#file_sizeObject

Returns the value of attribute file_size.



10
11
12
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 10

def file_size
  @file_size
end

#source_file_checksumObject

Returns the value of attribute source_file_checksum.



12
13
14
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 12

def source_file_checksum
  @source_file_checksum
end

#upload_operationsObject

Returns the value of attribute upload_operations.



13
14
15
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 13

def upload_operations
  @upload_operations
end

#uploadedObject

Returns the value of attribute uploaded.



15
16
17
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 15

def uploaded
  @uploaded
end

Class Method Details

.create(client: nil, app_store_version_id: nil, path: nil) ⇒ Object

API



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 34

def self.create(client: nil, app_store_version_id: nil, path: nil)
  client ||= Spaceship::ConnectAPI
  require 'faraday'

  filename = File.basename(path)
  filesize = File.size(path)
  bytes = File.binread(path)

  post_attributes = {
    fileSize: filesize,
    fileName: filename
  }

  # Create placeholder
  routing_app_coverage = client.post_routing_app_coverage(
    app_store_version_id: app_store_version_id,
    attributes: post_attributes
  ).to_models.first

  # Upload the file
  upload_operations = routing_app_coverage.upload_operations
  Spaceship::ConnectAPI::FileUploader.upload(upload_operations, bytes)

  # Update file uploading complete
  patch_attributes = {
    uploaded: true,
    sourceFileChecksum: Digest::MD5.hexdigest(bytes)
  }

  client.patch_routing_app_coverage(
    routing_app_coverage_id: routing_app_coverage.id,
    attributes: patch_attributes
  ).to_models.first
end

.typeObject



26
27
28
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 26

def self.type
  return "routingAppCoverages"
end

Instance Method Details

#delete!(client: nil) ⇒ Object



69
70
71
72
# File 'spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb', line 69

def delete!(client: nil)
  client ||= Spaceship::ConnectAPI
  client.delete_routing_app_coverage(routing_app_coverage_id: id)
end