Class: EspnFflApi::ApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/espn_ffl_api/api_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year) ⇒ ApiClient

Returns a new instance of ApiClient.



8
9
10
11
# File 'lib/espn_ffl_api/api_client.rb', line 8

def initialize(year)
  @year = year
  @league_id = EspnFflApi.config.league_id
end

Instance Attribute Details

#league_idObject (readonly)

Returns the value of attribute league_id.



5
6
7
# File 'lib/espn_ffl_api/api_client.rb', line 5

def league_id
  @league_id
end

#paramsObject



17
18
19
# File 'lib/espn_ffl_api/api_client.rb', line 17

def params
  @params ||= []
end

#viewsObject



13
14
15
# File 'lib/espn_ffl_api/api_client.rb', line 13

def views
  @views ||= []
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/espn_ffl_api/api_client.rb', line 5

def year
  @year
end

Instance Method Details

#getObject



21
22
23
24
25
# File 'lib/espn_ffl_api/api_client.rb', line 21

def get
  uri = build_uri(views: views, params: params)
  puts "HTTP GET: #{uri}"
  HTTParty.get(uri)
end