g5_ygl_client_20 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDllNWU5ZmUwY2Y3OWY0YmI0ZjBlYTE5Y2MxMzk4OGFlYTFhNmZhYg==
4
+ YTMzZTdkYzViYTRiM2FjYzM1NTk2M2M3OWY4NDgzZmM4ZTYxOGMxOQ==
5
5
  data.tar.gz: !binary |-
6
- OWVlMTQ4MmFmYTE1MmVkMTM2ZTE3OTY0YTVhNWI2OWRmMmNhMTY2ZQ==
6
+ MDk2MzkyYjBlMjUzNjllZWIxMzliNTYwYjA5YTE4MTRkNzcwOWFiYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjQ3ZTJiOWIzYzg1MTdhNThlMWU2YzU4M2FjYzI3ODIyYjhjMzJmNWQwZGIx
10
- MmRhYjYzNzY1ZWNhMDk5ZTNhNDU5NjExMzhjYzYyNjc1OTZlODYwNWI5MzY2
11
- NTUxYTA0NWQ5OWNhMmUzYmFlMjkyNzNjZDA0YmE2MjEzYTY3MmE=
9
+ MjE1ZmNlMWI5YjdlZmRmMDBhYTUxZmRjOTZhMzgzZDM0NTI4NWVhYzk1ZDEz
10
+ MjcxM2Q0ODU2ZjEwMTE1MzgyZmM3MmNiZTdhZjJkMjJlZDliYmVhNjJiNjJh
11
+ Mjc1MDZhODE1YTQ0ZTFiYmZkNTdiZWM5NTNkNDhmNDMyNzk1Y2U=
12
12
  data.tar.gz: !binary |-
13
- NDExZGY2Njc1MDZhZTBkNmVlZDJmY2U5ZTJjNzYwYTkzMWUyMTMyMGNmNWEw
14
- ZGE5YTZkNmEwOWJiYjVkYTU0ODRhMzc3NWZkYjJjODRiYTZmZjYyYzU2OGQ4
15
- ZmUzNjRhZDEzODgwOTQyODEyZjAzOGYwYmYwNzkwMGE2YmJlNDc=
13
+ YjdlNzMyN2JhNGM2MzlhOWZmMDYyZDQ3MDBlODdmMmFhOGUzNDEwYWZhZWYw
14
+ NjJmYzMyMGRiY2Y3OWI2NTk4MWUyZDVlN2YyODJjODk1YTY5NWE5MjhiYTEy
15
+ YmEyMDlhN2I2MjA0ODg4N2ViZGFkNTE3YzMzOTkyM2FkYzY0NGE=
@@ -17,7 +17,7 @@ module G5YglClient20
17
17
 
18
18
  HOST = "www.youvegotleads.com"
19
19
 
20
- def self.new(username, password, subscription_id)
21
- client = G5YglClient20::Client.new(username, password, subscription_id)
20
+ def self.new(username, password, subscription_id, source_id)
21
+ client = G5YglClient20::Client.new(username, password, subscription_id, source_id)
22
22
  end
23
23
  end
@@ -1,10 +1,11 @@
1
1
  module G5YglClient20
2
2
  class Client
3
3
 
4
- def initialize(username, password, subscription_id)
4
+ def initialize(username, password, subscription_id, source_id)
5
5
  @auth = "BASIC " + Base64.strict_encode64("#{username}:#{password}")
6
6
  @url = "https://www.youvegotleads.com/api/properties/"
7
7
  @subscription_id = subscription_id
8
+ @source_id = source_id || 588
8
9
  end
9
10
 
10
11
  def get_properties
@@ -16,7 +17,7 @@ module G5YglClient20
16
17
  end
17
18
 
18
19
  def post_lead(property_id, lead)
19
- request = PostLeadRequest.execute(@auth, @url, property_id, lead)
20
+ request = PostLeadRequest.execute(@auth, @url, @source_id, property_id, lead)
20
21
  end
21
22
 
22
23
  def get_leads_for_property(property_id)
@@ -1,7 +1,7 @@
1
1
  module G5YglClient20
2
2
  class PostLeadRequest
3
3
 
4
- def self.execute(auth,url,property_id, lead)
4
+ def self.execute(auth, url, source_id, property_id, lead)
5
5
  response = HTTParty.post("#{url}#{property_id}/leads",
6
6
  :headers => {"Authorization" => auth,
7
7
  "Host" => HOST,
@@ -12,7 +12,7 @@ module G5YglClient20
12
12
  "Address" => {"Email" => "#{lead[:email]}",
13
13
  "PhoneCell" => "#{lead[:phone]}"}},
14
14
  "CallCenterId" => "G5-#{lead[:id]}",
15
- "ReferralSources" => [{"LeadSourceId" => "588", "LeadSourceRank" => "1"}]
15
+ "ReferralSources" => [{"LeadSourceId" => "#{source_id}", "LeadSourceRank" => "1"}]
16
16
  }.to_json)
17
17
  end
18
18
 
@@ -1,3 +1,3 @@
1
1
  module G5YglClient20
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -2,19 +2,21 @@ require 'spec_helper'
2
2
  module G5YglClient20
3
3
  describe Client do
4
4
 
5
- let(:client) {G5YglClient20::Client.new("shinyandchrome", "aquacola", 3)}
5
+ let(:client) {G5YglClient20::Client.new("shinyandchrome", "aquacola", 3, 44)}
6
6
 
7
7
  describe "initialize" do
8
8
  it "assigns" do
9
9
  client.instance_variable_get(:@auth).should eq("BASIC c2hpbnlhbmRjaHJvbWU6YXF1YWNvbGE=")
10
10
  client.instance_variable_get(:@url).should eq("https://www.youvegotleads.com/api/properties/")
11
11
  client.instance_variable_get(:@subscription_id).should eq(3)
12
+ client.instance_variable_get(:@source_id).should eq(44)
12
13
  end
13
14
  end
14
15
 
15
16
  let(:url) {"https://www.youvegotleads.com/api/properties/"}
16
17
  let(:auth) {"BASIC c2hpbnlhbmRjaHJvbWU6YXF1YWNvbGE="}
17
18
  let(:subscription_id) {3}
19
+ let(:source_id) {44}
18
20
 
19
21
  describe "get_properties" do
20
22
  it "makes a Get Properties Request" do
@@ -32,7 +34,7 @@ module G5YglClient20
32
34
 
33
35
  describe "post_lead" do
34
36
  it "makes a Post Lead Request" do
35
- expect(PostLeadRequest).to receive(:execute).with(auth, url, 1, {})
37
+ expect(PostLeadRequest).to receive(:execute).with(auth, url, source_id, 1, {})
36
38
  client.post_lead(1,{})
37
39
  end
38
40
  end
@@ -5,6 +5,7 @@ module G5YglClient20
5
5
  let(:url) {"https://www.youvegotleads.com/api/properties/"}
6
6
  let(:auth) {"BASIC c2hpbnlhbmRjaHJvbWU6YXF1YWNvbGE="}
7
7
  let(:subscription_id) {3}
8
+ let(:source_id) {588}
8
9
 
9
10
  describe 'execute' do
10
11
  it "calls HTTParty post" do
@@ -15,7 +16,7 @@ module G5YglClient20
15
16
  "Content-Type" => "application/json"},
16
17
  :body=>"{\"PrimaryContact\":{\"FirstName\":\"mad\",\"LastName\":\"max\",\"Address\":{\"Email\":\"mad@max.com\",\"PhoneCell\":\"5418675309\"}},\"CallCenterId\":\"G5-50\",\"ReferralSources\":[{\"LeadSourceId\":\"588\",\"LeadSourceRank\":\"1\"}]}")
17
18
 
18
- PostLeadRequest.execute(auth, url, 1, {first_name: "mad",
19
+ PostLeadRequest.execute(auth, url, source_id, 1, {first_name: "mad",
19
20
  last_name: "max",
20
21
  email: "mad@max.com",
21
22
  phone: "5418675309",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g5_ygl_client_20
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Bishop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-12 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel