<commit_before>module Podio
  module Item
    include Podio::ResponseWrapper
    extend self

    def find(id)
      member Podio.connection.get("/item/#{id}").body
    end

    def find_basic(id)
      member Podio.connection.get("/item/#{id}/basic").body
    end

    def find_all_by_external_id(app_id, external_id)
      collection Podio.connection.get("/item/app/#{app_id}/v2/?external_id=#{external_id}").body
    end

    def find_all(app_id, options={})
      options.assert_valid_keys(:key, :limit, :offset, :sort_by, :sort_desc)

      collection Podio.connection.get { |req|
        req.url("/item/app/#{app_id}/", options)
      }.body
    end

    def create(app_id, attributes)
      response = Podio.connection.post do |req|
        req.url "/item/app/#{app_id}/"
        req.body = attributes
      end

      response.body['item_id']
    end
    
    def delete(id)
      Podio.connection.delete("/item/#{id}").body
    end
    
  end
end<commit_msg>Added find next and previous method to Item area<commit_after>module Podio
  module Item
    include Podio::ResponseWrapper
    extend self

    def find(id)
      member Podio.connection.get("/item/#{id}").body
    end

    def find_basic(id)
      member Podio.connection.get("/item/#{id}/basic").body
    end

    def find_all_by_external_id(app_id, external_id)
      collection Podio.connection.get("/item/app/#{app_id}/v2/?external_id=#{external_id}").body
    end

    def find_all(app_id, options={})
      options.assert_valid_keys(:key, :limit, :offset, :sort_by, :sort_desc)

      collection Podio.connection.get { |req|
        req.url("/item/app/#{app_id}/", options)
      }.body
    end
    
    def find_next(current_item_id, time = nil)
      find_next_or_previous(:next, current_item_id, time)
    end

    def find_previous(current_item_id, time = nil)
      find_next_or_previous(:previous, current_item_id, time)
    end

    def create(app_id, attributes)
      response = Podio.connection.post do |req|
        req.url "/item/app/#{app_id}/"
        req.body = attributes
      end

      response.body['item_id']
    end
    
    def delete(id)
      Podio.connection.delete("/item/#{id}").body
    end
    
    protected
    
      def time_options(time)
        time.present? ? { 'time' => (time.is_a?(String) ? time : time.to_s(:db)) } : {}
      end
      
      def find_next_or_previous(operation, current_item_id, time)
        member Podio.connection.get { |req|
          req.url("/item/#{current_item_id}/#{operation}", time_options(time))
        }.body
      end
    
  end
end
{'fraction_non_alphanumeric': 0.13173188686555598, 'fraction_numerical': 0.0007748934521503294, 'mean_word_length': 2.6520509193776522, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3675308', 'n_tokens_mistral': 872, 'n_tokens_neox': 853, 'n_words': 161}