Module: JsonRigs::FixtureClient

Defined in:
lib/json-rigs/client.rb

Constant Summary collapse

FIXTURE_URI =
'/fixtures'

Class Method Summary collapse

Class Method Details

.clear_active_fixturesObject



9
10
11
12
13
14
# File 'lib/json-rigs/client.rb', line 9

def clear_active_fixtures
  data = {
    :fixture_action => 'clear'
  }
  post_fixture(data)
end

.fixturesObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/json-rigs/client.rb', line 31

def fixtures
  data = {
    :fixture_action => 'get'
  }
  response = get_fixture(data)

  if response.body.length > 0
    puts "Fixture server error: #{response.body}"
  end

  puts response.body

  JSON.parse(response.body)
end

.set_fixture(url, method, action, fixture) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/json-rigs/client.rb', line 16

def set_fixture url, method, action, fixture
  data = {
    :url => url,
    :method => method,
    :action => action,
    :fixture => fixture,
    :fixture_action => 'set'
  }
  response = post_fixture(data)

  if response.body.length > 0
    puts "Fixture server error: #{response.body}"
  end
end