Class: RDStation::Client
- Inherits:
-
Object
- Object
- RDStation::Client
- Includes:
- HTTParty
- Defined in:
- lib/rdstation/client.rb
Overview
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
(also: #update_lead_info)
A hash do Lead pode conter os seguintes parâmetros: (obrigatório) :email :identificador :nome :empresa :cargo :telefone :celular :website :twitter :c_utmz :created_at :tags.
-
#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
Returns a new instance of Client.
9 10 11 12 13 |
# File 'lib/rdstation/client.rb', line 9 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
52 53 54 55 |
# File 'lib/rdstation/client.rb', line 52 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
57 58 59 |
# File 'lib/rdstation/client.rb', line 57 def change_lead_status(lead_hash) post_with_body("/services/#{@auth_token}/generic", :body => lead_hash ) end |
#create_lead(lead_hash) ⇒ Object Also known as: update_lead_info
A hash do Lead pode conter os seguintes parâmetros: (obrigatório) :email
:identificador
:nome
:empresa
:cargo
:telefone
:celular
:website
:twitter
:c_utmz
:created_at
:tags
Caso algum parâmetro não seja identificado como campo padrão ou como campo personalizado, este parâmetro desconhecido será gravado nos “Detalhes do Lead”.
34 35 36 37 38 |
# File 'lib/rdstation/client.rb', line 34 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 |