Class: PrizePicks::Client

Inherits:
Object
  • Object
show all
Includes:
Api::Endpoints, Faraday::Connection, Faraday::Request
Defined in:
lib/prizepicks/client.rb

Constant Summary

Constants included from Api::Endpoints::SignIn

Api::Endpoints::SignIn::ENDPOINT

Constants included from Api::Endpoints::Projections

Api::Endpoints::Projections::ENDPOINT

Constants included from Api::Endpoints::MemberTransactions

Api::Endpoints::MemberTransactions::ENDPOINT

Constants included from Api::Endpoints::Leagues

Api::Endpoints::Leagues::ENDPOINT

Constants included from Api::Endpoints::Entries

Api::Endpoints::Entries::ENDPOINT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Api::Endpoints::SignIn

#sign_in

Methods included from Api::Endpoints::Projections

#projections

Methods included from Api::Endpoints::MemberTransactions

#member_transactions, #parsed_resp

Methods included from Api::Endpoints::Leagues

#leagues

Methods included from Api::Endpoints::Entries

#entries

Methods included from Faraday::Request

#get, #post

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
16
17
18
19
# File 'lib/prizepicks/client.rb', line 11

def initialize(options = {})
  PrizePicks::Config::ATTRIBUTES.each do |key|
    send("#{key}=", options.fetch(key, PrizePicks.config.send(key)))
  end

  # For testing
  @stubs = options[:stubs] || nil
  @adapter = options[:adapter] || nil
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



9
10
11
# File 'lib/prizepicks/client.rb', line 9

def adapter
  @adapter
end

Instance Method Details

#inspectObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/prizepicks/client.rb', line 21

def inspect
  content = Config::ATTRIBUTES.map do |key|
    if key == :password
      "#{key}: [FILTERED]"
    else
      "#{key}: #{send(key).inspect}"
    end
  end.compact.join(', ')

  "#<#{self.class.name} #{content}>"
end