Skip to content

Commit

Permalink
Get API site parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed Apr 18, 2018
1 parent 02a8c50 commit e09afe6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
3 changes: 2 additions & 1 deletion app/helpers/sites_helper.rb
Expand Up @@ -3,7 +3,7 @@
module SitesHelper
def self.update_sites
require 'net/http'
url = URI.parse('https://api.stackexchange.com/2.2/sites?pagesize=1000&filter=!*L1-85AFULD6pPxF')
url = URI.parse('https://api.stackexchange.com/2.2/sites?pagesize=1000&filter=!SlEYpdqUFo-phXUJAq')
res = Net::HTTP.get_response(url)
sites = JSON.parse(res.body)['items']
return unless sites.count > 100 # all is not well; bail
Expand All @@ -19,6 +19,7 @@ def self.update_sites
puts "[\x1b[32mok\x1b[0m]"
end

s.api_parameter = site['api_site_parameter']
s.site_url = site['site_url']
s.site_logo = site['favicon_url'].gsub(/https?:/, '')
s.site_name = site['name']
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20180418210552_add_api_parameter_to_sites.rb
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddAPIParameterToSites < ActiveRecord::Migration[5.2]
def change
add_column :sites, :api_parameter, :string
end
end
17 changes: 9 additions & 8 deletions db/schema.rb
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2018_04_12_144542) do
ActiveRecord::Schema.define(version: 2018_04_18_210552) do

create_table "announcements", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.text "text"
Expand Down Expand Up @@ -64,7 +64,7 @@
t.index ["user_id", "user_type"], name: "user_index", length: { user_type: 191 }
end

create_table "blazer_audits", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
create_table "blazer_audits", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.bigint "user_id"
t.bigint "query_id"
t.text "statement"
Expand All @@ -74,7 +74,7 @@
t.index ["user_id"], name: "index_blazer_audits_on_user_id"
end

create_table "blazer_checks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
create_table "blazer_checks", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.bigint "creator_id"
t.bigint "query_id"
t.string "state"
Expand All @@ -89,7 +89,7 @@
t.index ["query_id"], name: "index_blazer_checks_on_query_id"
end

create_table "blazer_dashboard_queries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
create_table "blazer_dashboard_queries", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.bigint "dashboard_id"
t.bigint "query_id"
t.integer "position"
Expand All @@ -99,15 +99,15 @@
t.index ["query_id"], name: "index_blazer_dashboard_queries_on_query_id"
end

create_table "blazer_dashboards", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
create_table "blazer_dashboards", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.bigint "creator_id"
t.text "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["creator_id"], name: "index_blazer_dashboards_on_creator_id"
end

create_table "blazer_queries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
create_table "blazer_queries", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.bigint "creator_id"
t.string "name"
t.text "description"
Expand All @@ -118,7 +118,7 @@
t.index ["creator_id"], name: "index_blazer_queries_on_creator_id"
end

create_table "channels_users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
create_table "channels_users", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.bigint "user_id"
t.string "secret"
t.string "link"
Expand Down Expand Up @@ -158,7 +158,7 @@
t.integer "spam_domain_id", default: 0, null: false
end

create_table "dumps", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
create_table "dumps", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "file_file_name"
t.string "file_content_type"
t.integer "file_file_size"
Expand Down Expand Up @@ -350,6 +350,7 @@
t.integer "max_flags_per_post", default: 1
t.boolean "is_child_meta"
t.datetime "last_users_update"
t.string "api_parameter"
end

create_table "sites_user_site_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
Expand Down

0 comments on commit e09afe6

Please sign in to comment.