Class: Playfair::Client

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/playfair/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

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

#apiObject (readonly)

Returns the value of attribute api.



6
7
8
# File 'lib/playfair/client.rb', line 6

def api
  @api
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/playfair/client.rb', line 5

def email
  @email
end

#endpointObject

Returns the value of attribute endpoint.



5
6
7
# File 'lib/playfair/client.rb', line 5

def endpoint
  @endpoint
end

#passwordObject

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

Yields:

  • (_self)

Yield Parameters:



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