Class: Leadcli::Lead
Instance Attribute Summary collapse
-
#responses ⇒ Object
Returns the value of attribute responses.
Instance Method Summary collapse
- #create(params) ⇒ Object
- #delete(lead_id) ⇒ Object
- #handle_failure(response) ⇒ Object
- #handle_success(response) ⇒ Object
-
#initialize ⇒ Lead
constructor
A new instance of Lead.
- #last_response ⇒ Object
Methods included from ApiCall
Constructor Details
#initialize ⇒ Lead
Returns a new instance of Lead.
9 10 11 |
# File 'lib/leadcli/lead.rb', line 9 def initialize @responses = [] end |
Instance Attribute Details
#responses ⇒ Object
Returns the value of attribute responses.
7 8 9 |
# File 'lib/leadcli/lead.rb', line 7 def responses @responses end |
Instance Method Details
#create(params) ⇒ Object
13 14 15 |
# File 'lib/leadcli/lead.rb', line 13 def create(params) api_call :create, :url_options => {}, :payload => { :lead => params }, :failure => :handle_failure, :success => :handle_success end |
#delete(lead_id) ⇒ Object
17 18 19 |
# File 'lib/leadcli/lead.rb', line 17 def delete(lead_id) api_call :delete, :url_options => { :id => lead_id }, :failure => :handle_failure, :success => :handle_success end |
#handle_failure(response) ⇒ Object
21 22 23 24 |
# File 'lib/leadcli/lead.rb', line 21 def handle_failure(response) Leadcli.debug("LEAD API CALL FAILED : #{response}") @responses << response end |
#handle_success(response) ⇒ Object
26 27 28 |
# File 'lib/leadcli/lead.rb', line 26 def handle_success(response) @responses << response end |
#last_response ⇒ Object
30 31 32 |
# File 'lib/leadcli/lead.rb', line 30 def last_response @responses.last end |