Sha256: d6af3e021e2cd2643c3f68aa48f261e960e1c14036b96ac101d5fbec760e6918

Contents?: true

Size: 1.6 KB

Versions: 85

Compression:

Stored size: 1.6 KB

Contents

require_relative '../model'
module Spaceship
  class ConnectAPI
    class AppDataUsage
      include Spaceship::ConnectAPI::Model

      attr_accessor :category
      attr_accessor :grouping
      attr_accessor :purpose
      attr_accessor :data_protection

      attr_mapping({
        "category" => "category",
        "grouping" => "grouping",
        "dataProtection" => "data_protection"
      })

      def self.type
        return "appDataUsages"
      end

      #
      # Helpers
      #

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

      #
      # API
      #

      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

      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

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

Version data entries

85 entries across 85 versions & 4 rubygems

Version Path
fastlane-2.225.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.224.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.223.1 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.223.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.222.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.221.1 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.221.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.220.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.219.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.218.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-security-patched-2.216.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.217.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.216.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.215.1 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.215.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-mercafacil-2.214.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.214.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.213.0 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane-2.212.2 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb
fastlane_pricing_fix-2.212.1 spaceship/lib/spaceship/connect_api/models/app_data_usage.rb