Class: StatusUpdateRequest
- Defined in:
- lib/dto/status/status_update_request.rb
Overview
Class StatusUpdateRequest returns the correct string for request 3taps
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#event ⇒ Object
Returns the value of attribute event.
-
#timestump ⇒ Object
Returns the value of attribute timestump.
Instance Method Summary collapse
-
#attributes_for_params ⇒ Object
Method
attributes_for_params
creates array attributes for params. -
#errors_for_params ⇒ Object
Method
errors_for_params
array errors for params. -
#to_params ⇒ Object
Method
to_params
creates the correct string for request 3taps.
Methods inherited from Struct
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes
3 4 5 |
# File 'lib/dto/status/status_update_request.rb', line 3 def attributes @attributes end |
#errors ⇒ Object
Returns the value of attribute errors
3 4 5 |
# File 'lib/dto/status/status_update_request.rb', line 3 def errors @errors end |
#event ⇒ Object
Returns the value of attribute event
3 4 5 |
# File 'lib/dto/status/status_update_request.rb', line 3 def event @event end |
#timestump ⇒ Object
Returns the value of attribute timestump
3 4 5 |
# File 'lib/dto/status/status_update_request.rb', line 3 def timestump @timestump end |
Instance Method Details
#attributes_for_params ⇒ Object
Method attributes_for_params
creates array attributes for params.
17 18 19 |
# File 'lib/dto/status/status_update_request.rb', line 17 def attributes_for_params attributes.collect{ |key, value| "#{key}:'#{CGI.escape value}'" }.join(", ") end |
#errors_for_params ⇒ Object
Method errors_for_params
array errors for params.
23 24 25 |
# File 'lib/dto/status/status_update_request.rb', line 23 def errors_for_params errors.collect{ |error| "{code:#{error.code}, message:'#{CGI.escape error.}'}" }.join(", ") end |
#to_params ⇒ Object
Method to_params
creates the correct string for request 3taps.
7 8 9 10 11 12 13 |
# File 'lib/dto/status/status_update_request.rb', line 7 def to_params data = "status:'#{event}'" data << ", timestump:'#{((timestump).utc.to_s(:db)).gsub(/\s/,"+")}'" if timestump data << ", attributes:{#{attributes_for_params}}" unless attributes.empty? data << ", errors:[#{errors_for_params}]" unless errors.empty? data end |