Class: Spanx::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/spanx/client.rb,
lib/spanx/client/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.blocked_ipsObject



20
21
22
23
24
25
26
# File 'lib/spanx/client.rb', line 20

def self.blocked_ips
  response = request "/ips/blocked" do |uri|
    Net::HTTP::Get.new(uri.request_uri)
  end

  JSON.parse(response.body)
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Spanx::Client)

    the object that the method was called on



16
17
18
# File 'lib/spanx/client.rb', line 16

def self.configure
  yield self
end

.unblock(ip) ⇒ Object



28
29
30
31
32
# File 'lib/spanx/client.rb', line 28

def self.unblock(ip)
  request "/ips/blocked/#{ip}" do |uri|
    Net::HTTP::Delete.new(uri.request_uri)
  end
end

.urlObject



12
13
14
# File 'lib/spanx/client.rb', line 12

def self.url
  @url || "http://localhost:6060"
end

.url=(url) ⇒ Object



8
9
10
# File 'lib/spanx/client.rb', line 8

def self.url=(url)
  @url = url
end