Sha256: c95cdef3acf6d2f2904c0fe3b9c04e88f16f9f0fdf3fb3cea805b7bf2f58f01c

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

module Lolxin
  class Match
    BASE_ENDPOINT = "https://%s.api.pvp.net/api/lol/%s/%s/match"

    attr_accessor :conn

    def initialize(options = {})
      region   = options[:region]
      api_key  = options[:api_key]
      version  = options[:version]
      endpoint = BASE_ENDPOINT % [region, region, version]
      @conn    = Faraday.new(endpoint, options[:conn_options]) do |faraday|
        faraday.request(:url_encoded)
        faraday.response(:logger)
        faraday.adapter(Faraday.default_adapter)
        faraday.params[:api_key] = api_key
      end
    end

    def match(params = {}, &block)
      match_id = params.delete(:matchId).to_s
      conn.get(match_id, params, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lolxin-0.12.1 lib/lolxin/match.rb