Class: Pdga::Client

Inherits:
Object
  • Object
show all
Includes:
Auth, Course, Event, Player, Request
Defined in:
lib/pdga_api/client.rb

Overview

API Client for PDGA

Constant Summary

Constants included from Request

Request::API_ENDPOINT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Event

#events

Methods included from Player

#player_statistics, #players

Methods included from Course

#courses

Methods included from Auth

#connect, #login, #logout

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
# File 'lib/pdga_api/client.rb', line 23

def initialize(options = {})
  raise(ArgumentError, "username and password are required parameters") unless options.key?(:username) && options.key?(:password)

  @username = options[:username]
  @password = options[:password]

  (username: @username, password: @password)
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



16
17
18
# File 'lib/pdga_api/client.rb', line 16

def password
  @password
end

#sessidObject

Returns the value of attribute sessid.



16
17
18
# File 'lib/pdga_api/client.rb', line 16

def sessid
  @sessid
end

#session_nameObject

Returns the value of attribute session_name.



16
17
18
# File 'lib/pdga_api/client.rb', line 16

def session_name
  @session_name
end

#tokenObject

Returns the value of attribute token.



16
17
18
# File 'lib/pdga_api/client.rb', line 16

def token
  @token
end

#usernameObject

Returns the value of attribute username.



16
17
18
# File 'lib/pdga_api/client.rb', line 16

def username
  @username
end