useless-doc 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,12 @@
1
1
  require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
 
3
+ require 'useless/doc/core/body'
4
+ require 'useless/doc/core/header'
5
+ require 'useless/doc/core/request'
6
+ require 'useless/doc/core/resource'
7
+ require 'useless/doc/core/response'
3
8
  require 'useless/doc/serialization/dump'
9
+ require 'useless/doc/serialization/load'
4
10
 
5
11
  describe Useless::Doc::Serialization::Dump do
6
12
  describe '.hash_to_json' do
@@ -17,57 +23,51 @@ describe Useless::Doc::Serialization::Dump do
17
23
 
18
24
  describe '.resource' do
19
25
  it 'should convert the specified Doc::Resource instance into JSON' do
20
- get_parameter = Useless::Doc::Request::Parameter.new \
21
- type: Useless::Doc::Request::Parameter::Type::PATH,
22
- key: 'page',
23
- required: false,
24
- default: 1,
25
- description: 'The number of the page of twiddles.'
26
-
27
- get_request_header = Useless::Doc::Header.new \
28
- key: 'Content',
29
- description: 'The type of content.'
30
-
31
- get_request = Useless::Doc::Request.new \
32
- parameters: [get_parameter],
33
- headers: [get_request_header],
34
- body: nil
35
-
36
- get_status = Useless::Doc::Response::Status.new \
37
- code: 200,
38
- description: 'The list was successfully returned.'
39
-
40
- get_response_header = Useless::Doc::Header.new \
26
+ get_response_header = Useless::Doc::Core::Header.new \
41
27
  key: 'Type',
42
28
  description: 'The response type.'
43
29
 
44
- get_response_body_attribute = Useless::Doc::Body::Attribute.new \
30
+ get_response_body_attribute = Useless::Doc::Core::Body::Attribute.new \
45
31
  key: 'name',
46
32
  type: 'string',
47
33
  required: true,
48
34
  default: nil,
49
35
  description: 'The name of the twiddle.'
50
36
 
51
- get_response_body = Useless::Doc::Body.new \
37
+ get_response_body = Useless::Doc::Core::Body.new \
52
38
  content_type: 'application/json',
53
39
  attributes: [get_response_body_attribute]
54
40
 
55
- get_response = Useless::Doc::Response.new \
56
- statuses: [get_status],
57
- headers: [get_response_header],
58
- body: get_response_body
41
+ get_response = Useless::Doc::Core::Response.new \
42
+ code: 200,
43
+ description: 'The list was successfully returned.',
44
+ headers: [get_response_header],
45
+ body: get_response_body
46
+
47
+ get_request_parameter = Useless::Doc::Core::Request::Parameter.new \
48
+ type: Useless::Doc::Core::Request::Parameter::Type::PATH,
49
+ key: 'page',
50
+ required: false,
51
+ default: 1,
52
+ description: 'The number of the page of twiddles.'
53
+
54
+ get_request_header = Useless::Doc::Core::Header.new \
55
+ key: 'Content',
56
+ description: 'The type of content.'
59
57
 
60
- get = Useless::Doc::Action.new \
58
+ get_request = Useless::Doc::Core::Request.new \
59
+ method: Useless::Doc::Core::Request::Method::GET,
61
60
  description: 'See a whole list of twiddles.',
62
- method: Useless::Doc::Action::Method::GET,
63
61
  authentication_required: false,
64
- request: get_request,
65
- response: get_response
62
+ parameters: [get_request_parameter],
63
+ headers: [get_request_header],
64
+ body: nil,
65
+ responses: [get_response]
66
66
 
67
- resource = Useless::Doc::Resource.new \
67
+ resource = Useless::Doc::Core::Resource.new \
68
68
  path: '/twiddles',
69
69
  description: 'The full lot of twiddles.',
70
- actions: [get]
70
+ requests: [get_request]
71
71
 
72
72
  json = Useless::Doc::Serialization::Dump.resource(resource)
73
73
  hash = Useless::Doc::Serialization::Load.json_to_hash(json)
@@ -75,12 +75,11 @@ describe Useless::Doc::Serialization::Dump do
75
75
  hash['path'].should == '/twiddles'
76
76
  hash['description'].should == 'The full lot of twiddles.'
77
77
 
78
- get_hash = Useless::Doc::Serialization::Load.json_to_hash(hash['actions'][0])
79
- get_hash['description'].should == 'See a whole list of twiddles.'
80
- get_hash['method'].should == 'GET'
81
- get_hash['authentication_required'].should be_false
78
+ get_request_hash = Useless::Doc::Serialization::Load.json_to_hash(hash['requests'][0])
79
+ get_request_hash['description'].should == 'See a whole list of twiddles.'
80
+ get_request_hash['method'].should == 'GET'
81
+ get_request_hash['authentication_required'].should be_false
82
82
 
83
- get_request_hash = Useless::Doc::Serialization::Load.json_to_hash(get_hash['request'])
84
83
  get_request_paramter_hash = Useless::Doc::Serialization::Load.json_to_hash(get_request_hash['parameters'][0])
85
84
  get_request_paramter_hash['type'].should == 'path'
86
85
  get_request_paramter_hash['key'].should == 'page'
@@ -92,10 +91,9 @@ describe Useless::Doc::Serialization::Dump do
92
91
  get_request_header_hash['key'].should == 'Content'
93
92
  get_request_header_hash['description'].should == 'The type of content.'
94
93
 
95
- get_response_hash = Useless::Doc::Serialization::Load.json_to_hash(get_hash['response'])
96
- get_response_status_hash = Useless::Doc::Serialization::Load.json_to_hash(get_response_hash['statuses'][0])
97
- get_response_status_hash['code'].should == 200
98
- get_response_status_hash['description'].should == 'The list was successfully returned.'
94
+ get_response_hash = Useless::Doc::Serialization::Load.json_to_hash(get_request_hash['responses'][0])
95
+ get_response_hash['code'].should == 200
96
+ get_response_hash['description'].should == 'The list was successfully returned.'
99
97
 
100
98
  get_response_header_hash = Useless::Doc::Serialization::Load.json_to_hash(get_response_hash['headers'][0])
101
99
  get_response_header_hash['key'].should == 'Type'
@@ -21,79 +21,77 @@ describe Useless::Doc::Serialization::Load do
21
21
  document = load_document('twonk.json')
22
22
  resource = Useless::Doc::Serialization::Load.resource document.read
23
23
 
24
- resource.should be_a Useless::Doc::Resource
24
+ resource.should be_a Useless::Doc::Core::Resource
25
25
  resource.path.should == '/twonks/:id'
26
26
  resource.description.should == 'The most critical aspect.'
27
27
 
28
- get = resource.actions.first
29
- get.should be_a Useless::Doc::Action
30
- get.description.should == 'Retrieve a representation of an individual twonk.'
28
+ get = resource.requests.first
31
29
  get.method.should == 'GET'
30
+ get.description.should == 'Retrieve a representation of an individual twonk.'
32
31
  get.authentication_required.should == false
33
32
 
34
- get.request.parameters[0].type.should == 'path'
35
- get.request.parameters[0].key.should == 'id'
36
- get.request.parameters[0].required.should == true
37
- get.request.parameters[0].default.should be_nil
38
- get.request.parameters[0].description.should == 'The ID of the desired twonk.'
33
+ get.parameters[0].type.should == 'path'
34
+ get.parameters[0].key.should == 'id'
35
+ get.parameters[0].required.should == true
36
+ get.parameters[0].default.should be_nil
37
+ get.parameters[0].description.should == 'The ID of the desired twonk.'
39
38
 
40
- get.request.parameters[1].type.should == 'query'
41
- get.request.parameters[1].key.should == 'werp'
42
- get.request.parameters[1].required.should == false
43
- get.request.parameters[1].default.should == 12
44
- get.request.parameters[1].description.should == 'Self-explanatory.'
39
+ get.parameters[1].type.should == 'query'
40
+ get.parameters[1].key.should == 'werp'
41
+ get.parameters[1].required.should == false
42
+ get.parameters[1].default.should == 12
43
+ get.parameters[1].description.should == 'Self-explanatory.'
45
44
 
46
- get.request.headers[0].key.should == 'User-Agent'
47
- get.request.headers[0].description.should == 'The thingy you\'re using.'
45
+ get.headers[0].key.should == 'User-Agent'
46
+ get.headers[0].description.should == 'The thingy you\'re using.'
48
47
 
49
- get.response.statuses[0].code.should == 200
50
- get.response.statuses[0].description.should == 'The specified twonk was retrieved successfully.'
48
+ get.responses[0].code.should == 404
49
+ get.responses[0].description.should == 'A twonk with the specified ID could not be found.'
51
50
 
52
- get.response.statuses[1].code.should == 404
53
- get.response.statuses[1].description.should == 'A twonk with the specified ID could not be found.'
51
+ get.responses[1].code.should == 200
52
+ get.responses[1].description.should == 'The specified twonk was retrieved successfully.'
54
53
 
55
- get.response.body.content_type.should == 'application/json'
54
+ get.responses[1].body.content_type.should == 'application/json'
56
55
 
57
- get.response.body.attributes[0].key.should == 'name'
58
- get.response.body.attributes[0].type.should == 'string'
59
- get.response.body.attributes[0].required.should be_true
60
- get.response.body.attributes[0].default.should be_nil
61
- get.response.body.attributes[0].description.should == 'The name of the twonk.'
56
+ get.responses[1].body.attributes[0].key.should == 'name'
57
+ get.responses[1].body.attributes[0].type.should == 'string'
58
+ get.responses[1].body.attributes[0].required.should be_true
59
+ get.responses[1].body.attributes[0].default.should be_nil
60
+ get.responses[1].body.attributes[0].description.should == 'The name of the twonk.'
62
61
 
63
- get.response.body.attributes[1].key.should == 'created_by'
64
- get.response.body.attributes[1].type.should == 'object'
65
- get.response.body.attributes[1].required.should be_true
66
- get.response.body.attributes[1].default.should be_nil
67
- get.response.body.attributes[1].description.should == 'The short name of the user who created the twonk.'
62
+ get.responses[1].body.attributes[1].key.should == 'created_by'
63
+ get.responses[1].body.attributes[1].type.should == 'object'
64
+ get.responses[1].body.attributes[1].required.should be_true
65
+ get.responses[1].body.attributes[1].default.should be_nil
66
+ get.responses[1].body.attributes[1].description.should == 'The short name of the user who created the twonk.'
68
67
 
69
- put = resource.actions.last
70
- put.should be_a Useless::Doc::Action
71
- put.description.should =='Update a twonk.'
68
+ put = resource.requests.last
72
69
  put.method.should == 'PUT'
70
+ put.description.should =='Update a twonk.'
73
71
  put.authentication_required.should == true
74
72
 
75
- put.request.parameters[0].type.should == 'path'
76
- put.request.parameters[0].key.should == 'id'
77
- put.request.parameters[0].required.should == true
78
- put.request.parameters[0].default.should be_nil
79
- put.request.parameters[0].description.should == 'The ID of the twonk to be updated.'
73
+ put.parameters[0].type.should == 'path'
74
+ put.parameters[0].key.should == 'id'
75
+ put.parameters[0].required.should == true
76
+ put.parameters[0].default.should be_nil
77
+ put.parameters[0].description.should == 'The ID of the twonk to be updated.'
80
78
 
81
- put.request.body.content_type.should == 'application/x-www-form-urlencoded'
79
+ put.body.content_type.should == 'application/x-www-form-urlencoded'
82
80
 
83
- put.request.body.attributes[0].key.should == 'name'
84
- put.request.body.attributes[0].type.should == 'string'
85
- put.request.body.attributes[0].required.should be_true
86
- put.request.body.attributes[0].default.should be_nil
87
- put.request.body.attributes[0].description.should == 'The name of the twonk.'
81
+ put.body.attributes[0].key.should == 'name'
82
+ put.body.attributes[0].type.should == 'string'
83
+ put.body.attributes[0].required.should be_true
84
+ put.body.attributes[0].default.should be_nil
85
+ put.body.attributes[0].description.should == 'The name of the twonk.'
88
86
 
89
- put.request.body.attributes[1].key.should == 'hoinked_by'
90
- put.request.body.attributes[1].type.should == 'number'
91
- put.request.body.attributes[1].required.should be_false
92
- put.request.body.attributes[1].default.should == 3
93
- put.request.body.attributes[1].description.should == 'The ID of the person who hoinked this twonk.'
87
+ put.body.attributes[1].key.should == 'hoinked_by'
88
+ put.body.attributes[1].type.should == 'number'
89
+ put.body.attributes[1].required.should be_false
90
+ put.body.attributes[1].default.should == 3
91
+ put.body.attributes[1].description.should == 'The ID of the person who hoinked this twonk.'
94
92
 
95
- put.response.statuses[0].code.should == 201
96
- put.response.statuses[0].description.should == 'The specified twonk was updated successfully.'
93
+ put.responses[0].code.should == 201
94
+ put.responses[0].description.should == 'The specified twonk was updated successfully.'
97
95
  end
98
96
  end
99
97
  end
@@ -1,7 +1,9 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
2
 
3
+ require 'rack/test'
3
4
  require 'sinatra/base'
4
5
  require 'useless/doc/sinatra'
6
+ require 'useless/doc/serialization/load'
5
7
 
6
8
  describe Useless::Doc::Sinatra do
7
9
  class DocApp < Sinatra::Base
@@ -9,11 +11,9 @@ describe Useless::Doc::Sinatra do
9
11
 
10
12
  doc '/some-resources' do
11
13
  get 'Get all of these resources' do
12
- request do
13
- parameter 'since', 'Only resources after this date.'
14
- end
14
+ parameter 'since', 'Only resources after this date.'
15
15
 
16
- response do
16
+ response 200, 'The responses were fetched correctly.' do
17
17
  body do
18
18
  attribute 'name', 'The name of the resource.'
19
19
  end
@@ -21,15 +21,11 @@ describe Useless::Doc::Sinatra do
21
21
  end
22
22
 
23
23
  post 'Make a new resource' do
24
- request do
25
- body do
26
- attribute 'name', 'The name of the resource.'
27
- end
24
+ body do
25
+ attribute 'name', 'The name of the resource.'
28
26
  end
29
27
 
30
- response do
31
- status 201, 'The resource was successfully created.'
32
- end
28
+ response 201, 'The resource was successfully created.'
33
29
  end
34
30
  end
35
31
 
@@ -52,13 +48,13 @@ describe Useless::Doc::Sinatra do
52
48
  options 'http://some-api.granmal.com/some-resources'
53
49
  resource = Useless::Doc::Serialization::Load.resource(last_response.body)
54
50
 
55
- get = resource.actions.find { |action| action.method == Useless::Doc::Action::Method::GET }
51
+ get = resource.requests.find { |request| request.method == Useless::Doc::Core::Request::Method::GET }
56
52
  get.description.should == 'Get all of these resources'
57
- get.request.parameters.first.key.should == 'since'
53
+ get.parameters.first.key.should == 'since'
58
54
 
59
- post = resource.actions.find { |action| action.method == Useless::Doc::Action::Method::POST }
55
+ post = resource.requests.find { |request| request.method == Useless::Doc::Core::Request::Method::POST }
60
56
  post.description.should == 'Make a new resource'
61
- post.response.statuses.first.code.should == 201
57
+ post.responses[0].code.should == 201
62
58
  end
63
59
 
64
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useless-doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-04 00:00:00.000000000 Z
12
+ date: 2013-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oj
@@ -152,21 +152,18 @@ files:
152
152
  - README.md
153
153
  - Rakefile
154
154
  - lib/useless/doc.rb
155
- - lib/useless/doc/action.rb
156
- - lib/useless/doc/body.rb
155
+ - lib/useless/doc/core/body.rb
156
+ - lib/useless/doc/core/header.rb
157
+ - lib/useless/doc/core/request.rb
158
+ - lib/useless/doc/core/resource.rb
159
+ - lib/useless/doc/core/response.rb
157
160
  - lib/useless/doc/dsl.rb
158
- - lib/useless/doc/header.rb
159
161
  - lib/useless/doc/rack/application.rb
160
162
  - lib/useless/doc/rack/proxy.rb
161
163
  - lib/useless/doc/rack/retriever.rb
162
164
  - lib/useless/doc/rack/stylesheet.rb
163
165
  - lib/useless/doc/rack/transform.rb
164
166
  - lib/useless/doc/rack/ui.rb
165
- - lib/useless/doc/request.rb
166
- - lib/useless/doc/request/parameter.rb
167
- - lib/useless/doc/resource.rb
168
- - lib/useless/doc/response.rb
169
- - lib/useless/doc/response/status.rb
170
167
  - lib/useless/doc/serialization/dump.rb
171
168
  - lib/useless/doc/serialization/load.rb
172
169
  - lib/useless/doc/sinatra.rb
@@ -1,50 +0,0 @@
1
- module Useless
2
- module Doc
3
-
4
- # Documentation for an action on a API resource.
5
- #
6
- # @!attribute [r] description
7
- # @return [String] a description of the action.
8
- #
9
- # @!attribute [r] method
10
- # @return [String] the action's HTTP method.
11
- # @see Useless::Doc::Action::Method
12
- #
13
- # @!attribute [r] authentication_required
14
- # @return [Boolean] whether or not the user needs to authenticate in
15
- # order to perform this action.
16
- #
17
- # @!attribute [r] request
18
- # @return [Request] the request documentation for the action.
19
- #
20
- # @!attribute [r] response
21
- # @return [Response] the response documentation for the action.
22
- #
23
- class Action
24
-
25
- module Method
26
- GET = 'GET'
27
- HEAD = 'HEAD'
28
- POST = 'POST'
29
- PUT = 'PUT'
30
- PATCH = 'PATCH'
31
- DELETE = 'DELETE'
32
- TRACE = 'TRACE'
33
- CONNECT = 'CONNECT'
34
- end
35
-
36
- attr_reader :description, :method, :authentication_required,
37
- :request, :response
38
-
39
- # @param [Hash] attrs corresponds to the class's instance attributes.
40
- #
41
- def initialize(attrs = {})
42
- @description = attrs[:description]
43
- @method = attrs[:method]
44
- @authentication_required = attrs[:authentication_required]
45
- @request = attrs[:request]
46
- @response = attrs[:response]
47
- end
48
- end
49
- end
50
- end
@@ -1,58 +0,0 @@
1
- module Useless
2
- module Doc
3
-
4
- # Documentation for an HTTP body, belonging either to the request or the
5
- # response.
6
- #
7
- # @!attribute [r] content_type
8
- # @return [String] the MIME type of the body.
9
- #
10
- # @!attribute [r] attributes
11
- # @return [Array<Body::Attribute>] documentation for each of the body
12
- # attributes.
13
- #
14
- class Body
15
-
16
- attr_reader :content_type, :attributes
17
-
18
- # @param [Hash] attrs corresponds to the class's instance attributes.
19
- #
20
- def initialize(attrs)
21
- @content_type = attrs[:content_type]
22
- @attributes = attrs[:attributes]
23
- end
24
-
25
- # Documentation for an attribute on an HTTP body.
26
- #
27
- # @!attribute [r] key
28
- # @return [String] the key of this attribute in the body.
29
- #
30
- # @!attribute [r] value_type
31
- # @return [String] one of "string", "number", "object",
32
- # "array", or "boolean". "string" is the default value.
33
- #
34
- # @!attribute [r] required
35
- # @return [Boolean] whether or not the attribute is required. If it
36
- # is required, and the attribute is omitted, the response should have
37
- # a 4xx code. +true+ is the default value.
38
- #
39
- # @!attribute [r] description
40
- # @return [String] a description of the attribute.
41
- #
42
- class Attribute
43
-
44
- attr_reader :key, :type, :required, :default, :description
45
-
46
- # @param [Hash] attrs corresponds to the class's instance attributes.
47
- #
48
- def initialize(attrs)
49
- @key = attrs[:key]
50
- @type = attrs[:type] || 'string'
51
- @required = attrs.key?(:required) ? attrs[:required] : true
52
- @default = attrs[:default]
53
- @description = attrs[:description]
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,24 +0,0 @@
1
- module Useless
2
- module Doc
3
-
4
- # Documentation for an HTTP header, belonging either to the request or the
5
- # response.
6
- #
7
- # @!attribute [r] key
8
- # @return [String] the key of the header.
9
- #
10
- # @!attribute [r] description
11
- # @return [String] a description of the header.
12
- #
13
- class Header
14
- attr_accessor :key, :description
15
-
16
- # @param [Hash] attrs corresponds to the class's instance attributes.
17
- #
18
- def initialize(attrs = {})
19
- @key = attrs[:key]
20
- @description = attrs[:description]
21
- end
22
- end
23
- end
24
- end
@@ -1,47 +0,0 @@
1
- module Useless
2
- module Doc
3
- class Request
4
-
5
- # Documentation for a request parameter for an API action.
6
- #
7
- # @!attribute [r] type
8
- # @return [String] either "path" if it's part of the URL path, or
9
- # "query" if it's part of the query string.
10
- #
11
- # @!attribute [r] key
12
- # @return [String] the key of the parameter.
13
- #
14
- # @!attribute [r] required
15
- # @return [Boolean] whether or not the parameter is required. If it is
16
- # required, and the attribute is omitted, the response should have a
17
- # 4xx code.
18
- #
19
- # @!attribute [r] default
20
- # @return [String, Numeric] the value used if the parameter is omitted
21
- # and is not required.
22
- #
23
- # @!attribute [r] description
24
- # @return [String] a description of the parameter.
25
- #
26
- class Parameter
27
-
28
- module Type
29
- PATH = 'path'
30
- QUERY = 'query'
31
- end
32
-
33
- attr_reader :type, :key, :required, :default, :description
34
-
35
- # @param [Hash] attrs corresponds to the class's instance attributes.
36
- #
37
- def initialize(attrs = {})
38
- @type = attrs[:type]
39
- @key = attrs[:key]
40
- @required = attrs[:required]
41
- @default = attrs[:default]
42
- @description = attrs[:description]
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,29 +0,0 @@
1
- module Useless
2
- module Doc
3
-
4
- # Documentation for an HTTP request.
5
- #
6
- # @!attribute [r] parameters
7
- # @return [Array<Request::Parameter] documentation for the parameters
8
- # of the request.
9
- #
10
- # @!attribute [r] headers
11
- # @return [Array<Header>] documentation for the headers of the
12
- # request.
13
- #
14
- # @!attribute [r] body
15
- # @return [Body] documentation for the body of the request.
16
- #
17
- class Request
18
- attr_accessor :parameters, :headers, :body
19
-
20
- # @param [Hash] attrs corresponds to the class's instance attributes.
21
- #
22
- def initialize(attrs = {})
23
- @parameters = attrs[:parameters]
24
- @headers = attrs[:headers]
25
- @body = attrs[:body]
26
- end
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- module Useless
2
- module Doc
3
-
4
- # Documentation for an API resource.
5
- #
6
- # @!attribute [r] path
7
- # @return [String] the path segment of the resource URL.
8
- #
9
- # @!attribute [r] description
10
- # @return [String] a description of the resource.
11
- #
12
- # @!attribute [r] actions
13
- # @return [Array<Action>] documentation for the available actions for the
14
- # resource.
15
- #
16
- class Resource
17
-
18
- attr_reader :path, :description, :actions
19
-
20
- # @param [Hash] attrs corresponds to the class's instance attributes.
21
- #
22
- def initialize(attrs = {})
23
- @path = attrs[:path]
24
- @description = attrs[:description]
25
- @actions = attrs[:actions]
26
- end
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- module Useless
2
- module Doc
3
-
4
- # Documentation for an HTTP response.
5
- #
6
- # @!attribute [r] statuses
7
- # @return [Array<Response::Status] documentation for the possible
8
- # statuses of the response.
9
- #
10
- # @!attribute [r] headers
11
- # @return [Array<Header>] documentation for the headers of the
12
- # response.
13
- #
14
- # @!attribute [r] body
15
- # @return [Body] documentation for the body of the response.
16
- #
17
- class Response
18
- attr_accessor :statuses, :headers, :body
19
-
20
- # @param [Hash] attrs corresponds to the class's instance attributes.
21
- #
22
- def initialize(attrs = {})
23
- @statuses = attrs[:statuses]
24
- @headers = attrs[:headers]
25
- @body = attrs[:body]
26
- end
27
- end
28
- end
29
- end