Class: Queued::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/queued/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/queued/client.rb', line 6

def initialize(url, options = {})
  @url = url
  @auth = options[:auth]

  @conn = Faraday.new(:url => @url) do |conn|
    conn.use Middleware::Errors

    conn.request :json
    conn.response :json, :content_type => /\bjson$/
    
    conn.adapter Faraday.default_adapter
  end

  if @auth
    @conn.basic_auth('', @auth)
  end
end

Instance Method Details

#queue(name) ⇒ Object



24
25
26
# File 'lib/queued/client.rb', line 24

def queue(name)
  Queue.new(self, name)
end