Class: NflData::MySportsFeeds::Client
- Inherits:
-
Object
- Object
- NflData::MySportsFeeds::Client
- Defined in:
- lib/nfl_data/my_sports_feeds/client.rb
Instance Attribute Summary collapse
-
#api_host ⇒ Object
readonly
Returns the value of attribute api_host.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
Instance Method Summary collapse
- #get(endpoint:, params: {}) ⇒ Object
-
#initialize(api_host: ENV.fetch("MYSPORTSFEEDS_API_HOST"), api_key: ENV.fetch("MYSPORTSFEEDS_API_KEY"), api_version: ENV.fetch("MYSPORTSFEEDS_API_VERSION")) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_host: ENV.fetch("MYSPORTSFEEDS_API_HOST"), api_key: ENV.fetch("MYSPORTSFEEDS_API_KEY"), api_version: ENV.fetch("MYSPORTSFEEDS_API_VERSION")) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nfl_data/my_sports_feeds/client.rb', line 8 def initialize( api_host: ENV.fetch("MYSPORTSFEEDS_API_HOST"), api_key: ENV.fetch("MYSPORTSFEEDS_API_KEY"), api_version: ENV.fetch("MYSPORTSFEEDS_API_VERSION") ) @api_host = api_host @api_key = api_key @api_version = api_version @format = "json" @base_url = "#{@api_host}/#{@api_version}/pull/nfl/" end |
Instance Attribute Details
#api_host ⇒ Object (readonly)
Returns the value of attribute api_host.
6 7 8 |
# File 'lib/nfl_data/my_sports_feeds/client.rb', line 6 def api_host @api_host end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/nfl_data/my_sports_feeds/client.rb', line 6 def api_key @api_key end |
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
6 7 8 |
# File 'lib/nfl_data/my_sports_feeds/client.rb', line 6 def api_version @api_version end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/nfl_data/my_sports_feeds/client.rb', line 6 def base_url @base_url end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/nfl_data/my_sports_feeds/client.rb', line 6 def format @format end |
Instance Method Details
#get(endpoint:, params: {}) ⇒ Object
20 21 22 |
# File 'lib/nfl_data/my_sports_feeds/client.rb', line 20 def get(endpoint:, params: {}) request(method: :get, endpoint: endpoint, params: params) end |