Skip to content

Commit

Permalink
Improved docs & README
Browse files Browse the repository at this point in the history
  • Loading branch information
nTraum committed Jun 20, 2014
1 parent cbdd416 commit a7b1c4b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -28,7 +28,15 @@ $ gem install etf2l

## Usage

TODO: Write usage instructions here
### Whitelists

Fetch an array of whitelists currently used in the ETF2L:

```ruby
whitelists = Etf2l::API.whitelists
whitelists.first.name #=> "ETF2L Ultiduo"
whitelists.first.url #=> "http://etf2l.org/configs/etf2l_whitelist_ultiduo.txt"
```

## Contributing

Expand Down
9 changes: 5 additions & 4 deletions lib/etf2l/api.rb
Expand Up @@ -13,19 +13,20 @@ class API
#
# @return [Player] The requested player.
# @example by ETF2L ID
# API.player(10512)
# API.player(10512)
# @example by SteamID
# API.player("STEAM_0:0:18721806")
# API.player("STEAM_0:0:18721806")
# @example by SteamID64
# API.player(76561197997709340)
# API.player(76561197997709340)
def self.player(identifier)
response = get("/player/#{identifier}")
Player.new(response["player"])
end


# Returns an array of (currently used) whitelists.
#
# @example
# API.whitelists
# @return [Array<Whitelist>] an array of (currently used) whitelists.
def self.whitelists
response = get("/whitelists")
Expand Down
11 changes: 11 additions & 0 deletions lib/etf2l/resources/whitelist.rb
@@ -1,5 +1,16 @@
module Etf2l

# ETF2L whitelist.
class Whitelist

# @!attribute [r] name
# @return [String] name of the whitelist.
# @!attribute [r] filename
# @return [String] local file name when used on a game server.
# @!attribute [r] last_change
# @return [Time] timestamp of the last modification date.
# @!attribute [r] url
# @return [String] URL to the whitelist file.
attr_reader :name, :filename, :last_change, :url

def initialize(attributes)
Expand Down

0 comments on commit a7b1c4b

Please sign in to comment.