Class: Tomograph::Tomogram::Action
- Inherits:
-
Object
- Object
- Tomograph::Tomogram::Action
- Defined in:
- lib/tomograph/tomogram/action.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#responses ⇒ Object
readonly
Returns the value of attribute responses.
Instance Method Summary collapse
- #find_responses(status:) ⇒ Object
-
#initialize(path:, method:, content_type:, requests:, responses:, resource:) ⇒ Action
constructor
A new instance of Action.
- #to_hash ⇒ Object
Constructor Details
#initialize(path:, method:, content_type:, requests:, responses:, resource:) ⇒ Action
Returns a new instance of Action.
8 9 10 11 12 13 14 15 |
# File 'lib/tomograph/tomogram/action.rb', line 8 def initialize(path:, method:, content_type:, requests:, responses:, resource:) @path ||= Tomograph::Path.new(path) @method ||= method @content_type ||= content_type @requests ||= requests @responses ||= responses @resource ||= resource end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
6 7 8 |
# File 'lib/tomograph/tomogram/action.rb', line 6 def content_type @content_type end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/tomograph/tomogram/action.rb', line 6 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/tomograph/tomogram/action.rb', line 6 def path @path end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
6 7 8 |
# File 'lib/tomograph/tomogram/action.rb', line 6 def requests @requests end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
6 7 8 |
# File 'lib/tomograph/tomogram/action.rb', line 6 def resource @resource end |
#responses ⇒ Object (readonly)
Returns the value of attribute responses.
6 7 8 |
# File 'lib/tomograph/tomogram/action.rb', line 6 def responses @responses end |
Instance Method Details
#find_responses(status:) ⇒ Object
17 18 19 20 21 |
# File 'lib/tomograph/tomogram/action.rb', line 17 def find_responses(status:) to_hash['responses'].find_all do |response| response['status'] == status.to_s end end |
#to_hash ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tomograph/tomogram/action.rb', line 23 def to_hash @action ||= { 'path' => path, 'method' => method, 'content-type' => content_type, 'requests' => requests, 'responses' => responses, 'resource' => resource } end |