class Barcher::Client

Constants

API_ENDPOINT

Public Class Methods

new(options={}) click to toggle source
# File lib/barcher.rb, line 9
def initialize(options={})
  self.class.base_uri API_ENDPOINT
  self.class.headers "Accept" => "application/json", "authorization" => "Bearer #{options[:token]}"
end

Public Instance Methods

camelize_options(options) click to toggle source

TODO: move out of here or use ActiveSupport

# File lib/barcher.rb, line 44
def camelize_options(options)
  options.dup.each do |k,v|
    options[k.to_s.split('_').inject([]){|c,word| c.push(c.empty? ? word : word.capitalize)}.join] = v
  end
end
clan_members_for(clan_tag) click to toggle source
# File lib/barcher.rb, line 23
def clan_members_for(clan_tag)
  self.class.get("/clans/#{clan_tag}/members")
end
find_clan(clan_tag) click to toggle source
# File lib/barcher.rb, line 19
def find_clan(clan_tag)
  self.class.get("/clans/#{clan_tag}")
end
leagues() click to toggle source
# File lib/barcher.rb, line 39
def leagues
  self.class.get("/leagues")
end
location(id) click to toggle source
# File lib/barcher.rb, line 31
def location(id)
  self.class.get("/locations/#{id}")
end
locations() click to toggle source
# File lib/barcher.rb, line 27
def locations
  self.class.get("/locations")
end
rankings_at_location(location_id, ranking_id) click to toggle source
# File lib/barcher.rb, line 35
def rankings_at_location(location_id, ranking_id)
  self.class.get("/locations/#{location_id}/rankings/#{ranking_id}")
end