Class: Mountebank::Stub::Response
- Inherits:
-
Object
- Object
- Mountebank::Stub::Response
- Defined in:
- lib/mountebank/stub/response.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#inject ⇒ Object
Returns the value of attribute inject.
-
#is ⇒ Object
Returns the value of attribute is.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Response
constructor
A new instance of Response.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Response
Returns a new instance of Response.
4 5 6 7 8 |
# File 'lib/mountebank/stub/response.rb', line 4 def initialize(data={}) @is = data[:is] || nil @proxy = data[:proxy] || nil @inject = data[:inject] || nil end |
Instance Attribute Details
#inject ⇒ Object
Returns the value of attribute inject.
2 3 4 |
# File 'lib/mountebank/stub/response.rb', line 2 def inject @inject end |
#is ⇒ Object
Returns the value of attribute is.
2 3 4 |
# File 'lib/mountebank/stub/response.rb', line 2 def is @is end |
#proxy ⇒ Object
Returns the value of attribute proxy.
2 3 4 |
# File 'lib/mountebank/stub/response.rb', line 2 def proxy @proxy end |
Class Method Details
.with_injection(injection = '') ⇒ Object
10 11 12 13 14 15 |
# File 'lib/mountebank/stub/response.rb', line 10 def self.with_injection(injection='') return false if injection.empty? data = {inject:injection} new(data) end |
Instance Method Details
#to_json(*args) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/mountebank/stub/response.rb', line 17 def to_json(*args) data = {} data[:is] = @is unless @is.nil? data[:proxy] = @proxy unless @proxy.nil? data[:inject] = @inject unless @inject.nil? data.to_json(*args) end |