<commit_before>require_relative './presenter'

module Evercam
  module Presenters
    class User < Presenter

      root :users

      expose :id, documentation: {
        type: 'string',
        desc: 'Unique Evercam username',
        required: true
      } do |u,o|
        u.username
      end

      with_options(format_with: :timestamp) do

        expose :created_at, documentation: {
          type: 'integer',
          desc: 'Unix timestamp at creation',
          required: true
        }

        expose :updated_at, documentation: {
          type: 'integer',
          desc: 'Unix timestamp at last update',
          required: true
        }

        expose :confirmed_at, documentation: {
          type: 'integer',
          desc: 'Unix timestamp at account confirmation',
          required: true
        }

      end

      expose :firstname, documentation: {
        type: 'string',
        desc: 'Users first name',
        required: true
      }

      expose :lastname, documentation: {
        type: 'string',
        desc: 'Users last name',
        required: true
      }

      expose :username, documentation: {
        type: 'string',
        desc: 'Unique Evercam username',
        required: true
      }

      expose :email, documentation: {
        type: 'string',
        desc: 'Users email address',
        required: true
      }

      expose :country, documentation: {
        type: 'string',
        desc: 'Two letter <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO country code</a>',
        required: true
      } do |u,o|
        nil == u.country.iso3166_a2 ? "" : u.country.iso3166_a2
      end

      expose :billing_id, documentation: {
          type: 'string',
          desc: 'Users billing id',
          required: true
        }

    end
  end
end
<commit_msg>Use blank instead of nil<commit_after>require_relative './presenter'

module Evercam
  module Presenters
    class User < Presenter

      root :users

      expose :id, documentation: {
        type: 'string',
        desc: 'Unique Evercam username',
        required: true
      } do |u,o|
        u.username
      end

      with_options(format_with: :timestamp) do

        expose :created_at, documentation: {
          type: 'integer',
          desc: 'Unix timestamp at creation',
          required: true
        }

        expose :updated_at, documentation: {
          type: 'integer',
          desc: 'Unix timestamp at last update',
          required: true
        }

        expose :confirmed_at, documentation: {
          type: 'integer',
          desc: 'Unix timestamp at account confirmation',
          required: true
        }

      end

      expose :firstname, documentation: {
        type: 'string',
        desc: 'Users first name',
        required: true
      }

      expose :lastname, documentation: {
        type: 'string',
        desc: 'Users last name',
        required: true
      }

      expose :username, documentation: {
        type: 'string',
        desc: 'Unique Evercam username',
        required: true
      }

      expose :email, documentation: {
        type: 'string',
        desc: 'Users email address',
        required: true
      }

      expose :country, documentation: {
        type: 'string',
        desc: 'Two letter <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO country code</a>',
        required: true
      } do |u,o|
        u.country.iso3166_a2.blank? ? "" : u.country.iso3166_a2
      end

      expose :billing_id, documentation: {
          type: 'string',
          desc: 'Users billing id',
          required: true
        }

    end
  end
end

{'fraction_non_alphanumeric': 0.10083132207026012, 'fraction_numerical': 0.008581389112362564, 'mean_word_length': 1.8257575757575757, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '6873732', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1033, 'n_words': 295}