Class: Playfair::Client
- Inherits:
-
Object
- Object
- Playfair::Client
- Includes:
- Singleton
- Defined in:
- lib/playfair/client.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#email ⇒ Object
Returns the value of attribute email.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#password ⇒ Object
Returns the value of attribute password.
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/playfair/client.rb', line 8 def initialize @endpoint = "https://playfairapp.com" end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
6 7 8 |
# File 'lib/playfair/client.rb', line 6 def api @api end |
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/playfair/client.rb', line 5 def email @email end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/playfair/client.rb', line 5 def endpoint @endpoint end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/playfair/client.rb', line 5 def password @password end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/playfair/client.rb', line 12 def configure yield self @api = Her::API.new @api.setup url: @endpoint do |c| c.basic_auth @email, @password c.use Faraday::Request::UrlEncoded c.use Her::Middleware::DefaultParseJSON c.use Faraday::Adapter::NetHttp end end |