<commit_before>module Amiando

  ##
  # http://developers.amiando.com/index.php/REST_API_Events
  class Event < Resource
    map :host_id,                  :hostId
    map :selected_date,            :selectedDate,     :type => :time
    map :selected_end_date,        :selectedEndDate,  :type => :time
    map :short_description,        :shortDescription
    map :event_type,               :eventType
    map :organisator_display_name, :organisatorDisplayName
    map :partner_event_url,        :partnerEventUrl
    map :publish_search_engines,   :publishSearchEngines
    map :search_engine_tags,       :searchEngineTags
    map :location_description,     :locationDescription
    map :zip_code,                 :zipCode
    map :creation_time,            :creationTime,     :type => :time
    map :last_modified,            :lastModified,     :type => :time

    ##
    # Creates an event.
    #
    # @return [Event] will not return the full event and only the id attribute
    #   will be available.
    def self.create(attributes)
      object  = new
      request = post object, '/api/event/create',
        :params          => map_params(attributes),
        :populate_method => :populate_create

      object
    end

    ##
    # Fetch an event
    def self.find(id)
      object  = new
      request = get object, "/api/event/#{id}"

      object
    end

    ##
    # Search by identifier or title.
    #
    # @param [Hash] a hash with 1 entry, either :identifier or :title
    #
    # @return [Result] with an array of ids
    def self.search(by = {})
      unless by[:identifier].nil? ^ by[:title].nil? # XOR
        raise ArgumentError.new('Events can be searched either by identifier or by title, include only one.')
      end

      object  = Result.new { |response_body| response_body['ids'] }
      request = get object, '/api/event/find', :params => by

      object
    end

    def populate(response_body)
      extract_attributes_from(response_body, 'event')
    end

    def populate_create(response_body)
      @attributes = {:id => response_body['id']}
      @success    = response_body['success']
    end
  end<commit_msg>This parameter is mandatory<commit_after>module Amiando

  ##
  # http://developers.amiando.com/index.php/REST_API_Events
  class Event < Resource
    map :host_id,                  :hostId
    map :selected_date,            :selectedDate,     :type => :time
    map :selected_end_date,        :selectedEndDate,  :type => :time
    map :short_description,        :shortDescription
    map :event_type,               :eventType
    map :organisator_display_name, :organisatorDisplayName
    map :partner_event_url,        :partnerEventUrl
    map :publish_search_engines,   :publishSearchEngines
    map :search_engine_tags,       :searchEngineTags
    map :location_description,     :locationDescription
    map :zip_code,                 :zipCode
    map :creation_time,            :creationTime,     :type => :time
    map :last_modified,            :lastModified,     :type => :time

    ##
    # Creates an event.
    #
    # @return [Event] will not return the full event and only the id attribute
    #   will be available.
    def self.create(attributes)
      object  = new
      request = post object, '/api/event/create',
        :params          => map_params(attributes),
        :populate_method => :populate_create

      object
    end

    ##
    # Fetch an event
    def self.find(id)
      object  = new
      request = get object, "/api/event/#{id}"

      object
    end

    ##
    # Search by identifier or title.
    #
    # @param [Hash] a hash with 1 entry, either :identifier or :title
    #
    # @return [Result] with an array of ids
    def self.search(by)
      unless by[:identifier].nil? ^ by[:title].nil? # XOR
        raise ArgumentError.new('Events can be searched either by identifier or by title, include only one.')
      end

      object  = Result.new { |response_body| response_body['ids'] }
      request = get object, '/api/event/find', :params => by

      object
    end

    def populate(response_body)
      extract_attributes_from(response_body, 'event')
    end

    def populate_create(response_body)
      @attributes = {:id => response_body['id']}
      @success    = response_body['success']
    end
  end
{'fraction_non_alphanumeric': 0.09821221267703738, 'fraction_numerical': 0.0004643603436266543, 'mean_word_length': 2.329211746522411, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '5284169', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1239, 'n_words': 340}