Class: Markety::Response::SyncLeadResponse
- Inherits:
-
GenericResponse
- Object
- GenericResponse
- Markety::Response::SyncLeadResponse
- Defined in:
- lib/markety/response/sync_lead_response.rb
Overview
Response class for SyncLead commands
Instance Attribute Summary collapse
-
#lead_id ⇒ Object
readonly
the ID of the created or updated Lead (or nil if unsuccessful).
-
#update_type ⇒ Object
readonly
:created
or:updated
(or nil if unsuccessful). -
#updated_lead ⇒ Object
readonly
the updated or created Lead (or nil if unsuccessful).
Attributes inherited from GenericResponse
Instance Method Summary collapse
-
#initialize(response) ⇒ SyncLeadResponse
constructor
A new instance of SyncLeadResponse.
Methods inherited from GenericResponse
Constructor Details
#initialize(response) ⇒ SyncLeadResponse
Returns a new instance of SyncLeadResponse.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/markety/response/sync_lead_response.rb', line 16 def initialize(response) super(:sync_response,response) h = self.to_hash if self.success? sync_status = h[:success_sync_lead][:result][:sync_status] @lead_id = sync_status[:lead_id] @update_type = sync_status[:status].downcase.to_sym @updated_lead = ::Markety::Lead.from_hash(h[:success_sync_lead][:result][:lead_record]) else # overwrite super's crap error message with useful one @error_message = h[:fault][:detail][:service_exception][:message] end end |
Instance Attribute Details
#lead_id ⇒ Object (readonly)
the ID of the created or updated Lead (or nil if unsuccessful)
14 15 16 |
# File 'lib/markety/response/sync_lead_response.rb', line 14 def lead_id @lead_id end |
#update_type ⇒ Object (readonly)
:created
or :updated
(or nil if unsuccessful)
10 11 12 |
# File 'lib/markety/response/sync_lead_response.rb', line 10 def update_type @update_type end |
#updated_lead ⇒ Object (readonly)
the updated or created Lead (or nil if unsuccessful)
12 13 14 |
# File 'lib/markety/response/sync_lead_response.rb', line 12 def updated_lead @updated_lead end |