<commit_before># Copyright (C) 2015 Twitter, Inc.

module TwitterAds
  module Creative

    class PromotedTweet

      include TwitterAds::DSL
      include TwitterAds::Resource
      include TwitterAds::Persistence
      include TwitterAds::Analytics

      attr_reader :account

      property :id, read_only: true
      property :approval_status, read_only: true
      property :created_at, type: :time, read_only: true
      property :updated_at, type: :time, read_only: true
      property :deleted, type: :bool, read_only: true

      property :line_item_id
      property :tweet_id
      property :paused, type: :bool

      RESOURCE_COLLECTION = '/0/accounts/%{account_id}/promoted_tweets' # @api private
      RESOURCE_STATS      = '/0/stats/accounts/%{account_id}/promoted_tweets' # @api private
      RESOURCE            = '/0/accounts/%{account_id}/promoted_tweets/%{id}' # @api private

      def initialize(account)
        @account = account
        self
      end

      # Saves or updates the current object instance depending on the presence of `object.id`.
      #
      # @example
      #   object.save
      #
      # @return [self] Returns the instance refreshed from the API.
      #
      # Note: override to handle the inconsistency of the promoted tweet endpoint.
      #
      # @since 0.2.4
      def save
        # manually check for missing params (due to API discrepancy)
        validate<commit_msg>[minor] adding ticket reference to promoted tweet behavior override<commit_after># Copyright (C) 2015 Twitter, Inc.

module TwitterAds
  module Creative

    class PromotedTweet

      include TwitterAds::DSL
      include TwitterAds::Resource
      include TwitterAds::Persistence
      include TwitterAds::Analytics

      attr_reader :account

      property :id, read_only: true
      property :approval_status, read_only: true
      property :created_at, type: :time, read_only: true
      property :updated_at, type: :time, read_only: true
      property :deleted, type: :bool, read_only: true

      property :line_item_id
      property :tweet_id
      property :paused, type: :bool

      RESOURCE_COLLECTION = '/0/accounts/%{account_id}/promoted_tweets' # @api private
      RESOURCE_STATS      = '/0/stats/accounts/%{account_id}/promoted_tweets' # @api private
      RESOURCE            = '/0/accounts/%{account_id}/promoted_tweets/%{id}' # @api private

      def initialize(account)
        @account = account
        self
      end

      # Saves or updates the current object instance depending on the presence of `object.id`.
      #
      # @example
      #   object.save
      #
      # @return [self] Returns the instance refreshed from the API.
      #
      # Note: override to handle the inconsistency of the promoted tweet endpoint. (see REVAPI-5348)
      #
      # @since 0.2.4
      def save
        # manually check for missing params (due to API discrepancy)
        validate
{'fraction_non_alphanumeric': 0.08350374914792093, 'fraction_numerical': 0.0081799591002045, 'mean_word_length': 2.6056511056511056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5000537', 'n_tokens_mistral': 878, 'n_tokens_neox': 830, 'n_words': 255}