Sha256: 09eeb86fc99f96448a65bd08f499b278f719a58c6919e943dde0819e8c6fdbaf
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require "faraday" module CocRb class << self attr_accessor :configuration end def self.configure @configuration ||= Configuration.new yield(configuration) end class Configuration attr_accessor :token, :url def initialize @token = nil @url = nil end end class Settings def self.get @conn = Faraday.new( url:"https://api.clashofclans.com", headers: { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{CocRb.configuration.token}" } ) rescue => e raise "Oops Unexpected error Caught!" puts e end end class Check < Settings # This method gets headers for a particular endpoint. Takes the requestUrl in the configuration block. def self.get_Headers get res = @conn.get(CocRb.configuration.url) res.headers end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cocRb-1.1.5 | lib/cocRb/utility.rb |
cocRb-0.1.5 | lib/cocRb/utility.rb |