<commit_before># encoding: utf-8

class Api::V2::RootController < Api::V2Controller

  def index
    resp = {
      api: {
        version: 2,
        description:    "Cloudsdale Chat API",
        copyright:      "© IOMUSE 2012 – 2013",
        links: [
          {
            title: 'Cloudsdale',
            rel: 'website',
            href: root_url(subdomain: "www")
          },
          {
            title: 'Cloudsdale Terms of Service',
            rel: 'terms_of_use',
            href: page_url("terms-and-conditions", subdomain: "www")
          },
          {
            title: 'Cloudsdale Privacy Policy',
            rel: 'privacy_policy',
            href: page_url("privacy-policy",subdomain: "www")
          },
            title: 'Cloudsdale Developer Portal',
            rel: 'developers',
            href: root_url(subdomain: 'dev')
        ],
        refs: [
          {
            rel: 'me',
            href: v2_me_url(format: :json, host: $api_host)
          },
          {
            rel: 'me_auth_token',
            href: v2_auth_token_url(format: :json, host: $api_host)
          },
          {
            rel: 'me_session',
            href: v2_session_url(format: :json, host: $api_host)
          },
          {
            rel: 'convo',
            href: URI.unescape(v2_convo_url("{topic}",format: :json, host: $api_host))
          },
          {
            rel: 'convo_messages',
            href: URI.unescape(v2_convo_messages_url("{topic}",format: :json, host: $api_host))
          },
          {
            rel: 'cloud',
            href: URI.unescape(v2_cloud_url("{handle}", format: :json, host: $api_host))
          },
          {
            rel: 'clouds',
            href: URI.unescape(v2_clouds_url(format: :json, host: $api_host)) + "{?ids,id}"
          },
          {
            rel: 'search_clouds',
            href: URI.unescape(search_v2_clouds_url(format: :json, host: $api_host)) + "?query={keywords}"
          },
          {
            rel: 'user',
            href: URI.unescape(v2_user_url("{handle}", format: :json, host: $api_host))
          },
          {
            rel: 'users',
            href: URI.unescape(v2_users_url(format: :json, host: $api_host)) + "{?ids,id}"
          },
          {
            rel: 'search_users',
            href: URI.unescape(search_v2_users_url(format: :json, host: $api_host)) + "?query={keywords}"
          },
          {
            rel: 'spotlights',
            href: URI.unescape(v2_spotlights_url(format: :json, host: $api_host)) + "{?category}"
          },
          {
            rel: 'avatar',
            href: URI.unescape(avatar_url("{handle}", format: :png, host: $settings[:avatar][:https].gsub(/^(https?\:\/\/)/i,''), protocol: "https:"))
          }
        ]
      }
    }

    respond_with resp, status: 200
  end

  def lookup
    @record = Handle.lookup(params[:handle])
    @serializer = "#{@record.class.name}Serializer".constantize
    @root = @record.class.name.underscore
    respond_with_resource(@record, root: @root, serializer: @serializer)
  end

  def not_found
    render_exception("Resource could not be found. Are you sure this is what you're looking for?", 404)
  end

end
<commit_msg>Change HATEOAS url's to https.<commit_after># encoding: utf-8

class Api::V2::RootController < Api::V2Controller

  def index
    resp = {
      api: {
        version: 2,
        description:    "Cloudsdale Chat API",
        copyright:      "© IOMUSE 2012 – 2013",
        links: [
          {
            title: 'Cloudsdale',
            rel: 'website',
            href: root_url(subdomain: "www")
          },
          {
            title: 'Cloudsdale Terms of Service',
            rel: 'terms_of_use',
            href: page_url("terms-and-conditions", subdomain: "www")
          },
          {
            title: 'Cloudsdale Privacy Policy',
            rel: 'privacy_policy',
            href: page_url("privacy-policy",subdomain: "www")
          },
            title: 'Cloudsdale Developer Portal',
            rel: 'developers',
            href: root_url(subdomain: 'dev')
        ],
        refs: [
          {
            rel: 'me',
            href: v2_me_url(format: :json, host: $api_host, protocol: "https:")
          },
          {
            rel: 'me_auth_token',
            href: v2_auth_token_url(format: :json, host: $api_host, protocol: "https:")
          },
          {
            rel: 'me_session',
            href: v2_session_url(format: :json, host: $api_host, protocol: "https:")
          },
          {
            rel: 'convo',
            href: URI.unescape(v2_convo_url("{topic}",format: :json, host: $api_host, protocol: "https:"))
          },
          {
            rel: 'convo_messages',
            href: URI.unescape(v2_convo_messages_url("{topic}",format: :json, host: $api_host, protocol: "https:"))
          },
          {
            rel: 'cloud',
            href: URI.unescape(v2_cloud_url("{handle}", format: :json, host: $api_host, protocol: "https:"))
          },
          {
            rel: 'clouds',
            href: URI.unescape(v2_clouds_url(format: :json, host: $api_host, protocol: "https:")) + "{?ids,id}"
          },
          {
            rel: 'search_clouds',
            href: URI.unescape(search_v2_clouds_url(format: :json, host: $api_host, protocol: "https:")) + "?query={keywords}"
          },
          {
            rel: 'user',
            href: URI.unescape(v2_user_url("{handle}", format: :json, host: $api_host, protocol: "https:"))
          },
          {
            rel: 'users',
            href: URI.unescape(v2_users_url(format: :json, host: $api_host, protocol: "https:")) + "{?ids,id}"
          },
          {
            rel: 'search_users',
            href: URI.unescape(search_v2_users_url(format: :json, host: $api_host, protocol: "https:")) + "?query={keywords}"
          },
          {
            rel: 'spotlights',
            href: URI.unescape(v2_spotlights_url(format: :json, host: $api_host, protocol: "https:")) + "{?category}"
          },
          {
            rel: 'avatar',
            href: URI.unescape(avatar_url("{handle}", format: :png, host: $settings[:avatar][:https].gsub(/^(https?\:\/\/)/i,''), protocol: "https:"))
          }
        ]
      }
    }

    respond_with resp, status: 200
  end

  def lookup
    @record = Handle.lookup(params[:handle])
    @serializer = "#{@record.class.name}Serializer".constantize
    @root = @record.class.name.underscore
    respond_with_resource(@record, root: @root, serializer: @serializer)
  end

  def not_found
    render_exception("Resource could not be found. Are you sure this is what you're looking for?", 404)
  end

end

{'fraction_non_alphanumeric': 0.14813715303547573, 'fraction_numerical': 0.00890604126465786, 'mean_word_length': 1.8168896321070234, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3420689', 'n_tokens_mistral': 2156, 'n_tokens_neox': 2115, 'n_words': 426}