{"action":"created","issue":{"url":"https://api.github.com/repos/ctf0/Seti_UX/issues/15","repository_url":"https://api.github.com/repos/ctf0/Seti_UX","labels_url":"https://api.github.com/repos/ctf0/Seti_UX/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/ctf0/Seti_UX/issues/15/comments","events_url":"https://api.github.com/repos/ctf0/Seti_UX/issues/15/events","html_url":"https://github.com/ctf0/Seti_UX/pull/15","id":145447351,"number":15,"title":"Too bright yellow as background color for Ruby Environment variable","user":{"login":"Eric-Guo","id":1131536,"avatar_url":"https://avatars.githubusercontent.com/u/1131536?v=3","gravatar_id":"","url":"https://api.github.com/users/Eric-Guo","html_url":"https://github.com/Eric-Guo","followers_url":"https://api.github.com/users/Eric-Guo/followers","following_url":"https://api.github.com/users/Eric-Guo/following{/other_user}","gists_url":"https://api.github.com/users/Eric-Guo/gists{/gist_id}","starred_url":"https://api.github.com/users/Eric-Guo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eric-Guo/subscriptions","organizations_url":"https://api.github.com/users/Eric-Guo/orgs","repos_url":"https://api.github.com/users/Eric-Guo/repos","events_url":"https://api.github.com/users/Eric-Guo/events{/privacy}","received_events_url":"https://api.github.com/users/Eric-Guo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-03T03:01:53Z","updated_at":"2016-04-04T08:14:25Z","closed_at":"2016-04-04T07:33:37Z","pull_request":{"url":"https://api.github.com/repos/ctf0/Seti_UX/pulls/15","html_url":"https://github.com/ctf0/Seti_UX/pull/15","diff_url":"https://github.com/ctf0/Seti_UX/pull/15.diff","patch_url":"https://github.com/ctf0/Seti_UX/pull/15.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/ctf0/Seti_UX/issues/comments/205185127","html_url":"https://github.com/ctf0/Seti_UX/pull/15#issuecomment-205185127","issue_url":"https://api.github.com/repos/ctf0/Seti_UX/issues/15","id":205185127,"user":{"login":"Eric-Guo","id":1131536,"avatar_url":"https://avatars.githubusercontent.com/u/1131536?v=3","gravatar_id":"","url":"https://api.github.com/users/Eric-Guo","html_url":"https://github.com/Eric-Guo","followers_url":"https://api.github.com/users/Eric-Guo/followers","following_url":"https://api.github.com/users/Eric-Guo/following{/other_user}","gists_url":"https://api.github.com/users/Eric-Guo/gists{/gist_id}","starred_url":"https://api.github.com/users/Eric-Guo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eric-Guo/subscriptions","organizations_url":"https://api.github.com/users/Eric-Guo/orgs","repos_url":"https://api.github.com/users/Eric-Guo/repos","events_url":"https://api.github.com/users/Eric-Guo/events{/privacy}","received_events_url":"https://api.github.com/users/Eric-Guo/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T08:14:25Z","updated_at":"2016-04-04T08:14:25Z","body":"pleasure.\r\n\r\n```ruby\r\nmodule Wechat\r\n  module ApiLoader\r\n    def self.with(options)\r\n      c = ApiLoader.config\r\n\r\n      token_file = options[:token_file] || c.access_token || '/var/tmp/wechat_access_token'\r\n      js_token_file = options[:js_token_file] || c.jsapi_ticket || '/var/tmp/wechat_jsapi_ticket'\r\n\r\n      if c.appid && c.secret && token_file.present?\r\n        Wechat::Api.new(c.appid, c.secret, token_file, c.timeout, c.skip_verify_ssl, js_token_file)\r\n      elsif c.corpid && c.corpsecret && token_file.present?\r\n        Wechat::CorpApi.new(c.corpid, c.corpsecret, token_file, c.agentid, c.timeout, c.skip_verify_ssl, js_token_file)\r\n      else\r\n        puts <<-HELP\r\nNeed create ~/.wechat.yml with wechat appid and secret\r\nor running at rails root folder so wechat can read config/wechat.yml\r\nHELP\r\n        exit 1\r\n      end\r\n    end\r\n\r\n    @config = nil\r\n\r\n    def self.config\r\n      return @config unless @config.nil?\r\n      @config ||= loading_config!\r\n      @config\r\n    end\r\n\r\n    private_class_method\r\n\r\n    def self.loading_config!\r\n      config ||= config_from_file || config_from_environment\r\n\r\n      if defined?(::Rails)\r\n        config[:access_token] ||= Rails.root.join('tmp/access_token').to_s\r\n        config[:jsapi_ticket] ||= Rails.root.join('tmp/jsapi_ticket').to_s\r\n      end\r\n      config[:timeout] ||= 20\r\n      config[:have_session_class] = class_exists?('WechatSession')\r\n      config.symbolize_keys!\r\n      @config = OpenStruct.new(config)\r\n    end\r\n\r\n    def self.config_from_file\r\n      if defined?(::Rails)\r\n        config_file = Rails.root.join('config/wechat.yml')\r\n        return YAML.load(ERB.new(File.read(config_file)).result)[Rails.env] if File.exist?(config_file)\r\n      else\r\n        rails_config_file = File.join(Dir.getwd, 'config/wechat.yml')\r\n        home_config_file = File.join(Dir.home, '.wechat.yml')\r\n        if File.exist?(rails_config_file)\r\n          rails_env = ENV['RAILS_ENV'] || 'default'\r\n          config = YAML.load(ERB.new(File.read(rails_config_file)).result)[rails_env]\r\n          if config.present? && (config['appid'] || config['corpid'])\r\n            puts \"Using rails project config/wechat.yml #{rails_env} setting...\"\r\n            return config\r\n          end\r\n        end\r\n        if File.exist?(home_config_file)\r\n          return YAML.load ERB.new(File.read(home_config_file)).result\r\n        end\r\n      end\r\n    end\r\n\r\n    def self.config_from_environment\r\n      { appid: ENV['WECHAT_APPID'],\r\n        secret: ENV['WECHAT_SECRET'],\r\n        corpid: ENV['WECHAT_CORPID'],\r\n        corpsecret: ENV['WECHAT_CORPSECRET'],\r\n        agentid: ENV['WECHAT_AGENTID'],\r\n        token: ENV['WECHAT_TOKEN'],\r\n        access_token: ENV['WECHAT_ACCESS_TOKEN'],\r\n        encrypt_mode: ENV['WECHAT_ENCRYPT_MODE'],\r\n        timeout: ENV['WECHAT_TIMEOUT'],\r\n        skip_verify_ssl: ENV['WECHAT_SKIP_VERIFY_SSL'],\r\n        encoding_aes_key: ENV['WECHAT_ENCODING_AES_KEY'],\r\n        jsapi_ticket: ENV['WECHAT_JSAPI_TICKET'],\r\n        trusted_domain_fullname: ENV['WECHAT_TRUSTED_DOMAIN_FULLNAME'] }\r\n    end\r\n\r\n    def self.class_exists?(class_name)\r\n      return Module.const_get(class_name).present?\r\n    rescue NameError\r\n      return false\r\n    end\r\n  end\r\nend\r\n```"}}