<commit_before>require 'securerandom'

class Rakutentrend
    include ActiveModel::Model
    include Rss

    # genleId 200162 = 本・雑誌・コミック
    def self.get(genre: "200162")
        application_id = 'e0e12265d6dc712a1d081ff58f8a8441'
        affiliate_id = '0f7e7e37.751871da.0f7e7e38.994f9407'
        url = 'https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20170628?applicationId=' + application_id + '&affiliateId=' + affiliate_id + '&format=json&carrier=1&genreId=' + genre
        uri = URI.parse(url)
        puts "[URL]" + url
        json = Net::HTTP.get(uri)
        obj_list = JSON.parse(json)
        
        rankingList = Array.new
        obj_list["Items"].each{|obj_item|
            each_result = {}
            #puts "[obj_item]"
            #puts obj_item
            eachItem = {
                "id" => SecureRandom.uuid,
                "title" => obj_item["Item"]["itemName"],
                "link" => obj_item["Item"]["itemUrl"],
                "pubDate" => DateTime.now.strftime("%Y-%m-%d"),
                "description" => obj_item["Item"]["itemCaption"],
            }
            rankingList.push(eachItem)
          }

        #puts rankingList

        output = {
            "value" => {
                "title" => "rakuten book ranking",
                "link" => "https://books.rakuten.co.jp/",
                "description" => "",
                "items" => rankingList
            }
        }
        output

    end
      
end<commit_msg>fix rakuten http to https<commit_after>require 'securerandom'

class Rakutentrend
    include ActiveModel::Model
    include Rss

    # genleId 200162 = 本・雑誌・コミック
    def self.get(genre: "200162")
        application_id = 'e0e12265d6dc712a1d081ff58f8a8441'
        affiliate_id = '0f7e7e37.751871da.0f7e7e38.994f9407'
        url = 'https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20170628?applicationId=' + application_id + '&affiliateId=' + affiliate_id + '&format=json&carrier=1&genreId=' + genre
        uri = URI.parse(url)
        puts "[URL]" + url
        json = Net::HTTP.get(uri)
        obj_list = JSON.parse(json)
        
        rankingList = Array.new
        obj_list["Items"].each{|obj_item|
            each_result = {}
            #puts "[obj_item]"
            #puts obj_item
            eachItem = {
                "id" => SecureRandom.uuid,
                "title" => obj_item["Item"]["itemName"],
                "link" => obj_item["Item"]["itemUrl"].gsub("http://", "https://").gsub("http%3A%2F%2F", "https%3A%2F%2F"),
                "pubDate" => DateTime.now.strftime("%Y-%m-%d"),
                "description" => obj_item["Item"]["itemCaption"],
            }
            rankingList.push(eachItem)
          }

        #puts rankingList

        output = {
            "value" => {
                "title" => "rakuten book ranking",
                "link" => "https://books.rakuten.co.jp/",
                "description" => "",
                "items" => rankingList
            }
        }
        output

    end
      
end
{'fraction_non_alphanumeric': 0.14501312335958005, 'fraction_numerical': 0.04461942257217848, 'mean_word_length': 1.8310120705663882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 5, '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': '5869397', 'n_tokens_mistral': 1101, 'n_tokens_neox': 994, 'n_words': 145}