class Sightstone::DatadragonModule

Public Class Methods

new(sightstone) click to toggle source
# File lib/sightstone/modules/datadragon_module.rb, line 5
def initialize(sightstone)
  @sightstone = sightstone
end

Public Instance Methods

version(optional={}) { |data| ... } click to toggle source
# File lib/sightstone/modules/datadragon_module.rb, line 9
def version(optional={})
  region = optional[:region] || @sightstone.region
  uri = "https://ddragon.leagueoflegends.com/realms/#{region}.json"
 
  response = _get_api_response(uri)
  _parse_response(response) { |resp|
    data = JSON.parse(resp)
    if block_given?
      yield data['v']
    else
      return data['v']
    end
  }
end