Class: Dm3::Api::Responses::Base
- Inherits:
-
Object
- Object
- Dm3::Api::Responses::Base
- Defined in:
- lib/dm3/api/responses/base.rb
Direct Known Subclasses
BookingSubjects, Bookings, CreateBooking, DestroyBooking, KokyakuCmsPages, ShowStatus, SpentTime, UpdateBooking
Instance Attribute Summary collapse
-
#dish ⇒ Object
readonly
Returns the value of attribute dish.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#initialize(raw_response) ⇒ Base
constructor
A new instance of Base.
- #method_missing(*args, &block) ⇒ Object
Constructor Details
#initialize(raw_response) ⇒ Base
Returns a new instance of Base.
4 5 6 7 8 9 |
# File 'lib/dm3/api/responses/base.rb', line 4 def initialize(raw_response) @raw_response = raw_response @json = raw_response.body @hash = JSON.parse(json) @dish = Dish(hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
11 12 13 |
# File 'lib/dm3/api/responses/base.rb', line 11 def method_missing(*args, &block) dish.public_send(args.first) end |
Instance Attribute Details
#dish ⇒ Object (readonly)
Returns the value of attribute dish.
2 3 4 |
# File 'lib/dm3/api/responses/base.rb', line 2 def dish @dish end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
2 3 4 |
# File 'lib/dm3/api/responses/base.rb', line 2 def hash @hash end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
2 3 4 |
# File 'lib/dm3/api/responses/base.rb', line 2 def json @json end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
2 3 4 |
# File 'lib/dm3/api/responses/base.rb', line 2 def raw_response @raw_response end |