Class: RDStation::Client
- Inherits:
-
Object
- Object
- RDStation::Client
- Includes:
- HTTParty
- Defined in:
- lib/rdstation/client.rb
Overview
Mais informações em www.rdstation.com.br/docs/api
Instance Method Summary collapse
-
#change_lead(lead, lead_hash) ⇒ Object
param lead: id ou email do Lead a ser alterado.
- #change_lead_status(lead_hash) ⇒ Object
-
#create_lead(lead_hash) ⇒ Object
A hash de lead pode conter os parametros (requerido) :identificador (requerido) :email :nome :empresa :cargo :telefone :celular :website :twitter :c_utmz.
-
#initialize(rdstation_token, auth_token, identifier = "integração") ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(rdstation_token, auth_token, identifier = "integração") ⇒ Client
8 9 10 11 12 |
# File 'lib/rdstation/client.rb', line 8 def initialize(rdstation_token, auth_token, identifier="integração") @identificador = identifier @rdstation_token = rdstation_token @auth_token = auth_token end |
Instance Method Details
#change_lead(lead, lead_hash) ⇒ Object
param lead:
id ou email do Lead a ser alterado
param lead_hash:
Hash contendo:
:lifecycle_stage
0 - Lead; 1 - Lead Qualificado; 2 - Cliente
:opportunity
true ou false
44 45 46 47 |
# File 'lib/rdstation/client.rb', line 44 def change_lead(lead, lead_hash) lead_hash = auth_token_hash.merge({:lead => lead_hash}) put_with_body("/leads/#{lead}", :body => lead_hash.to_json, :headers => {'Content-Type' => 'application/json'}) end |
#change_lead_status(lead_hash) ⇒ Object
49 50 51 |
# File 'lib/rdstation/client.rb', line 49 def change_lead_status(lead_hash) post_with_body("/services/#{@auth_token}/generic", :body => lead_hash ) end |
#create_lead(lead_hash) ⇒ Object
A hash de lead pode conter os parametros (requerido) :identificador (requerido) :email
:nome
:empresa
:cargo
:telefone
:celular
:website
:twitter
:c_utmz
27 28 29 30 31 |
# File 'lib/rdstation/client.rb', line 27 def create_lead(lead_hash) lead_hash = rdstation_token_hash.merge(lead_hash) lead_hash = lead_hash.merge(identifier_hash) unless lead_hash.has_key?(:identificador) post_with_body("/conversions", {:body => lead_hash}) end |