holoserve-connector 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- = HoloServe Connector - Connector library for HoloServe.
2
+ = Holoserve Connector - Connector library for Holoserve.
3
3
 
4
- This library provides a client to the control interface of HoloServe and RSpec matchers to integrate HoloServe in a
5
- test suite. See {holoserve}[https://github.com/skrill/holoserve] for details about the concept of HoloServe.
4
+ This library provides a client to the control interface of Holoserve and RSpec matchers to integrate Holoserve in a
5
+ test suite. See {holoserve}[https://github.com/skrill/holoserve] for details about the concept of Holoserve.
6
6
 
7
7
  == Example
8
8
 
@@ -1,6 +1,6 @@
1
1
  require 'transport'
2
2
 
3
- class Holoserve::Connector::Layouts
3
+ class Holoserve::Connector::Layout
4
4
 
5
5
  def initialize(client)
6
6
  @client = client
@@ -10,14 +10,14 @@ class Holoserve::Connector::Layouts
10
10
 
11
11
  def clear!
12
12
  Transport::JSON.request :delete,
13
- "#{@client.url}/layouts",
13
+ "#{@client.url}/layout",
14
14
  :expected_status_code => 200
15
15
  end
16
16
 
17
- def upload_yml(filename)
17
+ def upload_yaml(filename)
18
18
  Transport::HTTP.request :post,
19
- "#{@client.url}/layouts",
20
- :body => upload_yml_file_request_body(filename),
19
+ "#{@client.url}/layout.yaml",
20
+ :body => upload_yaml_file_request_body(filename),
21
21
  :headers => {
22
22
  "Content-Type" => "multipart/form-data, boundary=#{@boundary}"
23
23
  },
@@ -27,21 +27,26 @@ class Holoserve::Connector::Layouts
27
27
  raise Holoserve::Connector::Error, error.message
28
28
  end
29
29
 
30
- def available
31
- Transport::JSON.request :get, "#{@client.url}/layouts/ids"
30
+ def download_yaml
31
+ response = Transport::HTTP.request :get,
32
+ "#{@client.url}/layout.yaml",
33
+ :expected_status_code => 200
34
+ YAML.load response
35
+ rescue Transport::UnexpectedStatusCodeError => error
36
+ raise Holoserve::Connector::Error, error.message
32
37
  end
33
38
 
34
- def current=(id)
35
- Transport::JSON.request :put, "#{@client.url}/layouts/#{id}/current"
39
+ def situation=(value)
40
+ Transport::JSON.request :put, "#{@client.url}/situation/#{value}"
36
41
  end
37
42
 
38
- def current
39
- Transport::HTTP.request :get, "#{@client.url}/layouts/current"
43
+ def situation
44
+ Transport::HTTP.request :get, "#{@client.url}/situation"
40
45
  end
41
46
 
42
47
  private
43
48
 
44
- def upload_yml_file_request_body(filename)
49
+ def upload_yaml_file_request_body(filename)
45
50
  "--#{@boundary}\r\n" +
46
51
  "Content-Disposition: form-data; name=\"file\"; filename=\"#{File.basename(filename)}\"\r\n" +
47
52
  "Content-Type: application/x-yaml\r\n" +
@@ -3,14 +3,14 @@ class Holoserve::Connector
3
3
 
4
4
  autoload :Bucket, File.join(File.dirname(__FILE__), "connector", "bucket")
5
5
  autoload :History, File.join(File.dirname(__FILE__), "connector", "history")
6
- autoload :Layouts, File.join(File.dirname(__FILE__), "connector", "layouts")
6
+ autoload :Layout, File.join(File.dirname(__FILE__), "connector", "layout")
7
7
 
8
8
  class Error < StandardError; end
9
9
 
10
10
  attr_reader :host
11
11
  attr_reader :port
12
12
 
13
- attr_reader :layouts
13
+ attr_reader :layout
14
14
  attr_reader :bucket
15
15
  attr_reader :history
16
16
 
@@ -19,7 +19,7 @@ class Holoserve::Connector
19
19
  @host ||= "localhost"
20
20
  @port ||= 4250
21
21
 
22
- @layouts = Layouts.new self
22
+ @layout = Layout.new self
23
23
  @bucket = Bucket.new self
24
24
  @history = History.new self
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holoserve-connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-19 00:00:00.000000000 Z
12
+ date: 2012-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: transport
16
- requirement: &70253145056100 !ruby/object:Gem::Requirement
16
+ requirement: &70248250590080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70253145056100
24
+ version_requirements: *70248250590080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: holoserve
27
- requirement: &70253145052760 !ruby/object:Gem::Requirement
27
+ requirement: &70248250588860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70253145052760
35
+ version_requirements: *70248250588860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &70253145051660 !ruby/object:Gem::Requirement
38
+ requirement: &70248250587660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70253145051660
46
+ version_requirements: *70248250587660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70253145050340 !ruby/object:Gem::Requirement
49
+ requirement: &70248250586220 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70253145050340
57
+ version_requirements: *70248250586220
58
58
  description: Provides a client for the control interface of holoserve and some RSpec
59
59
  matchers.
60
60
  email: philipp.bruell@skrill.com
@@ -68,7 +68,7 @@ files:
68
68
  - Rakefile
69
69
  - lib/holoserve/connector/bucket.rb
70
70
  - lib/holoserve/connector/history.rb
71
- - lib/holoserve/connector/layouts.rb
71
+ - lib/holoserve/connector/layout.rb
72
72
  - lib/holoserve/connector.rb
73
73
  - lib/rspec/holoserve.rb
74
74
  - spec/helper.rb
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  segments:
90
90
  - 0
91
- hash: 2293304529508499132
91
+ hash: 4236575270905341654
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  none: false
94
94
  requirements: