<commit_before>require 'tumblr_client'
require 'json'
module TumblrClientWrapper
  module Posts
    class ApiRequest
      VALID_OPTION_KEYS = [
          :params,
          :id,
          :tag,
          :limit,
          :offset,
          :reblog_info,
          :type,
          :notes_info,
          :filter
        ]
        
      def initialize
          @@tumblr_client = Tumblr::Client.new(client: :httpclient)
      end

      def get_posts(tumblr_id, options)
          unless options.present?
              response = @@tumblr_client.posts("#{tumblr_id}.tumblr.com")
          else
              response = @@tumblr_client.posts("#{tumblr_id}.tumblr.com", options)
          end
      end

      def options(&block)
           VALID_OPTION_KEYS.each {|key| (options[key] = yield[key]) if yield[key]}
      end

      def paginate(tumbld_id, offset)
          response = @@tumblr_client.posts("#{tumblr_id}.tumblr.com", offset: offset)
      end
    end

    def embed_post(tumblr_id, options)
      api = ApiRequest.new
      posts = api.get_posts(tumblr_id, options)
      embed = ""
      if posts["posts"]
        posts["posts"].each do |post|
            post_type = post["type"]
            case post_type
            when "text" 
                title = post["title"]
                body  = post["body"]
                date  = post["date"]
                embed += %Q(<commit_msg>Options is working<commit_after>require 'tumblr_client'
require 'json'
module TumblrClientWrapper
  module Posts
    class ApiRequest
        
      def initialize
          @@tumblr_client = Tumblr::Client.new(client: :httpclient)
      end

      def get_posts(tumblr_id, options)
          unless options.present?
              response = @@tumblr_client.posts("#{tumblr_id}.tumblr.com")
          else
              response = @@tumblr_client.posts("#{tumblr_id}.tumblr.com", options)
          end
      end

      def paginate(tumbld_id, offset)
          response = @@tumblr_client.posts("#{tumblr_id}.tumblr.com", offset: offset)
      end
    end

    def embed_post(tumblr_id, options)
      api = ApiRequest.new
      posts = api.get_posts(tumblr_id, options)
      embed = ""
      if posts["posts"]
        posts["posts"].each do |post|
            post_type = post["type"]
            case post_type
            when "text" 
                title = post["title"]
                body  = post["body"]
                date  = post["date"]
                embed += %Q(
{'fraction_non_alphanumeric': 0.10923014913341395, 'fraction_numerical': 0.0, 'mean_word_length': 1.7919010123734533, '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': '801062', 'n_tokens_mistral': 811, 'n_tokens_neox': 722, 'n_words': 152}