Created
April 24, 2013 16:05
-
-
Save jason/5453319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
require 'json' | |
require 'pp' | |
require 'net-http-spy' | |
class Lead | |
include HTTParty | |
format :json | |
base_uri 'app.close.io' | |
basic_auth 'd2e994b0e296377c74ae8036bcf3daaa197307f0573d77fa4426348d', ' ' | |
end | |
puts "name" | |
name = gets.chomp | |
lead = {:name => name, :contacts => [{ :name => "Jdubs", :phones => [{ :phone => "4153342961", :type => "office" }], :emails => [{ :email => "technique@gmail.com", :type => "office" }]}]}.to_json | |
puts lead | |
pp Lead.post('/api/v1/lead', {:body => lead, :headers => {'Content-Type' => 'application/json'}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby closelead.rb | |
name | |
rastkuqwfkt | |
{:name=>"rastkuqwfkt", :contacts=>[{:name=>"Jdubs", :phones=>[{:phone=>"4153342961", :type=>"office"}], :emails=>[{:email=>"technique@gmail.com", :type=>"office"}]}]} | |
I, [2013-04-24T07:18:41.110939 #21186] INFO -- : CONNECT: ["app.close.io", 80] | |
I, [2013-04-24T07:18:41.111055 #21186] INFO -- : POST /api/v1/lead | |
I, [2013-04-24T07:18:41.317552 #21186] INFO -- : PARAMS {"{\"name\":\"rastkuqwfkt\",\"contacts\":[{\"name\":\"Jdubs\",\"phones\":[{\"phone\":\"4153342961\",\"type\":\"office\"}],\"emails\":[{\"email\":\"technique@gmail.com\",\"type\":\"office\"}]}]}"=>[]} | |
I, [2013-04-24T07:18:41.317619 #21186] INFO -- : BODY: Net::HTTPFound | |
I, [2013-04-24T07:18:41.317870 #21186] INFO -- : CONNECT: ["app.close.io", 443] | |
I, [2013-04-24T07:18:41.317935 #21186] INFO -- : GET /api/v1/lead | |
I, [2013-04-24T07:18:41.561565 #21186] INFO -- : PARAMS {"{\"name\":\"rastkuqwfkt\",\"contacts\":[{\"name\":\"Jdubs\",\"phones\":[{\"phone\":\"4153342961\",\"type\":\"office\"}],\"emails\":[{\"email\":\"technique@gmail.com\",\"type\":\"office\"}]}]}"=>[]} | |
I, [2013-04-24T07:18:41.561657 #21186] INFO -- : BODY: Net::HTTPMovedPermanently | |
I, [2013-04-24T07:18:41.561971 #21186] INFO -- : CONNECT: ["app.close.io", 443] | |
I, [2013-04-24T07:18:41.562049 #21186] INFO -- : GET /api/v1/lead/ | |
I, [2013-04-24T07:18:41.872780 #21186] INFO -- : PARAMS {"{\"name\":\"rastkuqwfkt\",\"contacts\":[{\"name\":\"Jdubs\",\"phones\":[{\"phone\":\"4153342961\",\"type\":\"office\"}],\"emails\":[{\"email\":\"technique@gmail.com\",\"type\":\"office\"}]}]}"=>[]} | |
I, [2013-04-24T07:18:41.872880 #21186] INFO -- : BODY: Net::HTTPOK | |
{"has_more"=>false, | |
"data"=> | |
[{"status"=>nil, | |
"activities"=> | |
[{"attachments"=>[], | |
"body_text"=> | |
"Hi! My name is Steli and I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\n\nCheers,\nSteli", | |
"date_updated"=>"2013-04-18T19:04:46.803000+00:00", | |
"created_by_name"=>nil, | |
"_type"=>"Email", | |
"contact_id"=>"cont_UNFMIfNrzHfVVpHeXSfEIGeKOPrEZASCRmdGYLwoKCz", | |
"id"=>"acti_7sZB49RndzUlTYkY0MV26DTgaKeqrLH1k0MUpmXYTk0", | |
"updated_by_name"=>"Jason Wong", | |
"subject"=>"Welcome to Close.io!", | |
"user_id"=>"user_pFekdYVwN6EwMHV9v41qWCdmdejNL0UJwejiAPonvBC", | |
"created_by"=>nil, | |
"to"=>["technique@gmail.com"], | |
"template_name"=>nil, | |
"user_name"=>"Jason Wong", | |
"opens"=>[], | |
"status"=>"inbox", | |
"direction"=>"incoming", | |
"updated_by"=>"user_pFekdYVwN6EwMHV9v41qWCdmdejNL0UJwejiAPonvBC", | |
"envelope"=> | |
{"from"=>[{"email"=>"steli@close.io", "name"=>""}], | |
"sender"=>[{"email"=>"steli@close.io", "name"=>""}], | |
"cc"=>[], | |
"bcc"=>[], | |
"to"=>[{"email"=>"technique@gmail.com", "name"=>""}], | |
"reply_to"=>[], | |
"date"=>"Thu, 18 Apr 2013 04:29:42 +0000", | |
"in_reply_to"=>nil, | |
"message_id"=> | |
"<20130418042942.4128.9514@ec2-54-245-86-79.us-west-2.compute.amazonaws.com>", | |
"subject"=>"Welcome to Close.io!"}, | |
"is_new"=>false, | |
"organization_id"=>"orga_17T2fghUrNsTdjTlfABIdFRhbjHA9P1lJg2PVr60klH", | |
"need_smtp_credentials"=>false, | |
"body_text_quoted"=> | |
[{"text"=> | |
"Hi! My name is Steli and I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\n\nCheers,\nSteli", | |
"expand"=>true}], | |
"send_attempts"=>[], | |
"sender"=>"steli@close.io", | |
"lead_id"=>"lead_6Z0UaURBv7hRYR0W6U9hpAusT0wkqsASJz2WdxJZwUm", | |
"bcc"=>[], | |
"date_sent"=>nil, | |
"date_created"=>"2013-04-18T04:29:42.348000+00:00", | |
"template_id"=>nil, | |
"cc"=>[]}], | |
"tasks"=> | |
[{"due_date"=>"2013-04-23", | |
"updated_by"=>nil, | |
"date_updated"=>"2013-04-18T04:29:42.283000+00:00", | |
"text"=>"Connect with Steli", | |
"assigned_to"=>"user_pFekdYVwN6EwMHV9v41qWCdmdejNL0UJwejiAPonvBC", | |
"created_by"=>nil, | |
"is_complete"=>false, | |
"organization_id"=>"orga_17T2fghUrNsTdjTlfABIdFRhbjHA9P1lJg2PVr60klH", | |
"updated_by_name"=>nil, | |
"assigned_to_name"=>"Jason Wong", | |
"created_by_name"=>nil, | |
"date_created"=>"2013-04-18T04:29:42.283000+00:00", | |
"lead_name"=>"Close.io", | |
"id"=>"task_o0lSgW54cKSkmCqMeho8AGqRyr45s5PG1rYKMxLcnC8", | |
"lead_id"=>"lead_6Z0UaURBv7hRYR0W6U9hpAusT0wkqsASJz2WdxJZwUm"}], | |
"display_name"=>"Close.io", | |
"addresses"=> | |
[{"city"=>"Mountain View", | |
"country"=>"US", | |
"zipcode"=>"94043", | |
"label"=>"primary", | |
"state"=>"CA", | |
"address_1"=>"1955 Landings Drive", | |
"address_2"=>nil}], | |
"contacts"=> | |
[{"name"=>"Steli Efti", | |
"title"=>"CEO", | |
"date_updated"=>"2013-04-18T04:29:42.194000+00:00", | |
"phones"=> | |
[{"phone"=>"+16505176539", | |
"phone_formatted"=>"+1 650-517-6539", | |
"type"=>"office"}], | |
"created_by"=>nil, | |
"id"=>"cont_UNFMIfNrzHfVVpHeXSfEIGeKOPrEZASCRmdGYLwoKCz", | |
"organization_id"=>"orga_17T2fghUrNsTdjTlfABIdFRhbjHA9P1lJg2PVr60klH", | |
"urls"=>[], | |
"date_created"=>"2013-04-18T04:29:42.194000+00:00", | |
"emails"=>[{"type"=>"office", "email"=>"steli@close.io"}], | |
"updated_by"=>nil}, | |
{"name"=>"Close.io Support", | |
"title"=>nil, | |
"date_updated"=>"2013-04-18T04:29:42.243000+00:00", | |
"phones"=> | |
[{"phone"=>"+18552567346", | |
"phone_formatted"=>"+1 855-256-7346", | |
"type"=>"office"}], | |
"created_by"=>nil, | |
"id"=>"cont_Y2iDhLwyWlWUE97A7IQBXlpbvdJOaafNSKtO42dW5m4", | |
"organization_id"=>"orga_17T2fghUrNsTdjTlfABIdFRhbjHA9P1lJg2PVr60klH", | |
"urls"=>[], | |
"date_created"=>"2013-04-18T04:29:42.243000+00:00", | |
"emails"=>[{"type"=>"office", "email"=>"support@close.io"}], | |
"updated_by"=>nil}], | |
"date_updated"=>"2013-04-18T19:04:46.838000+00:00", | |
"created_by_name"=>nil, | |
"description"=>nil, | |
"html_url"=> | |
"https://app.close.io/lead/lead_6Z0UaURBv7hRYR0W6U9hpAusT0wkqsASJz2WdxJZwUm/", | |
"created_by"=>nil, | |
"custom"=>{}, | |
"organization_id"=>"orga_17T2fghUrNsTdjTlfABIdFRhbjHA9P1lJg2PVr60klH", | |
"url"=>nil, | |
"opportunities"=>[], | |
"updated_by"=>"user_pFekdYVwN6EwMHV9v41qWCdmdejNL0UJwejiAPonvBC", | |
"date_created"=>"2013-04-18T04:29:42.259000+00:00", | |
"id"=>"lead_6Z0UaURBv7hRYR0W6U9hpAusT0wkqsASJz2WdxJZwUm", | |
"updated_by_name"=>"Jason Wong", | |
"name"=>"Close.io"}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should probably hide your auth key... :)