Class: Spaceship::ConnectAPI::AppDataUsage

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
spaceship/lib/spaceship/connect_api/models/app_data_usage.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

#categoryObject

Returns the value of attribute category.



7
8
9
# File 'spaceship/lib/spaceship/connect_api/models/app_data_usage.rb', line 7

def category
  @category
end

#data_protectionObject

Returns the value of attribute data_protection.



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

def data_protection
  @data_protection
end

#groupingObject

Returns the value of attribute grouping.



8
9
10
# File 'spaceship/lib/spaceship/connect_api/models/app_data_usage.rb', line 8

def grouping
  @grouping
end

#purposeObject

Returns the value of attribute purpose.



9
10
11
# File 'spaceship/lib/spaceship/connect_api/models/app_data_usage.rb', line 9

def purpose
  @purpose
end

Class Method Details

.all(app_id:, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

API



35
36
37
38
39
40
# File 'spaceship/lib/spaceship/connect_api/models/app_data_usage.rb', line 35

def self.all(app_id:, filter: {}, includes: nil, limit: nil, sort: nil)
  raise "app_id is required " if app_id.nil?

  resps = Spaceship::ConnectAPI.get_app_data_usages(app_id: app_id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

.create(app_id:, app_data_usage_category_id: nil, app_data_usage_protection_id: nil, app_data_usage_purpose_id: nil) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'spaceship/lib/spaceship/connect_api/models/app_data_usage.rb', line 42

def self.create(app_id:, app_data_usage_category_id: nil, app_data_usage_protection_id: nil, app_data_usage_purpose_id: nil)
  raise "app_id is required " if app_id.nil?

  resp = Spaceship::ConnectAPI.post_app_data_usage(
    app_id: app_id,
    app_data_usage_category_id: app_data_usage_category_id,
    app_data_usage_protection_id: app_data_usage_protection_id,
    app_data_usage_purpose_id: app_data_usage_purpose_id
  )
  return resp.to_models.first
end

.typeObject



18
19
20
# File 'spaceship/lib/spaceship/connect_api/models/app_data_usage.rb', line 18

def self.type
  return "appDataUsages"
end

Instance Method Details

#delete!Object



54
55
56
# File 'spaceship/lib/spaceship/connect_api/models/app_data_usage.rb', line 54

def delete!
  Spaceship::ConnectAPI.delete_app_data_usage(app_data_usage_id: id)
end

#is_not_collected?Boolean

Helpers

Returns:

  • (Boolean)


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

def is_not_collected?
  return false unless data_protection
  return data_protection.id == "DATA_NOT_COLLECTED"
end