markety 1.3.5 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.coveralls.yml +1 -0
- data/.gitignore +41 -0
- data/.rspec +2 -0
- data/.travis.yml +17 -0
- data/Gemfile +3 -0
- data/Guardfile +11 -0
- data/LICENCE +21 -0
- data/README.md +49 -0
- data/Rakefile +8 -0
- data/lib/markety/lead_record.rb +14 -6
- data/lib/markety/version.rb +1 -1
- data/markety.gemspec +38 -0
- data/spec/markety/authentication_header_spec.rb +66 -0
- data/spec/markety/client_spec.rb +10 -0
- data/spec/markety/lead_key_spec.rb +38 -0
- data/spec/markety/lead_record_spec.rb +120 -0
- data/spec/spec_helper.rb +5 -0
- metadata +163 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjNhMzgyYWQ2MzE3MzJiZDhjZmViZWZmNTYxNjU2MjNmODMzMjk1Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTdhZDU4YzVlZmIyMDE3YWFmMzJjYjM5N2VhMmQyM2FjYWZmMGQzNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTY2MmM2YjE4Yjc5M2IyMmVjMzAzNTNmNzVjZjFjZTM3OGI4OTJmOWVmMjIx
|
10
|
+
YTQ2YzZlOWNhNDI2MTg3M2Y2MzMxYjA1YWZiODA4OWIxZWY5YjFmMmE5MjRk
|
11
|
+
NjNiNjEyZjIwZTZkYjc3ZmQyOTJlMTVjMDgyY2JhZjY4OTIxNTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjMwMDAwYThlYmZiYmY1OTgzZTQzODhkMWUyZThiNzgyMDg0YmZlMWFiM2Yz
|
14
|
+
YmEyMThkZjkyNzQzOTU0OWY3ZjAzYWE1ZWM3MmZlNWIzNmE1OTBjY2Y0MzU4
|
15
|
+
YTgwMTViOWUyNjM2MDhiMTRhYjk4M2MwZjE4OWI1M2MwYmQ5ZDQ=
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
Gemfile.lock
|
30
|
+
.ruby-version
|
31
|
+
.ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
35
|
+
|
36
|
+
## `bundle gem ...` extras
|
37
|
+
*.bundle
|
38
|
+
*.so
|
39
|
+
*.o
|
40
|
+
*.a
|
41
|
+
mkmf.log
|
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
- 2.1.1
|
8
|
+
|
9
|
+
script: 'bundle exec rake'
|
10
|
+
|
11
|
+
notifications:
|
12
|
+
email:
|
13
|
+
recipients:
|
14
|
+
- david.e.santoso@gmail.com
|
15
|
+
- marius.butuc@gmail.com
|
16
|
+
on_failure: change
|
17
|
+
on_success: never
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENCE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 David Santoso
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Markety
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/davidsantoso/markety.svg?branch=master)](https://travis-ci.org/davidsantoso/markety)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/markety.svg)](http://badge.fury.io/rb/markety)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/davidsantoso/markety/badge.png)](https://coveralls.io/r/davidsantoso/markety)
|
6
|
+
|
7
|
+
Easily integrate with the Marketo SOAP API to find and update leads.
|
8
|
+
|
9
|
+
This is a fork off of the [Rapleaf marketo_gem] (https://github.com/Rapleaf/marketo_gem) but has been updated to work with Savon v2.3.1. It makes connecting to your Marketo database to find and update leads a snap. If you're having problems connecting to Marketo, please submit an issue as there have been lots of changes with [Savon] (https://github.com/savonrb/savon) lately.
|
10
|
+
|
11
|
+
## Install
|
12
|
+
Add this your Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'markety'
|
16
|
+
```
|
17
|
+
|
18
|
+
and run bundle install.
|
19
|
+
|
20
|
+
## Examples
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# Instantiate a new Markety client using your Marketo SOAP endpoint, User ID, and Encryption Key
|
24
|
+
client = Markety.new_client(USER_ID, ENCRYPTION_KEY, END_POINT)
|
25
|
+
|
26
|
+
# Get a lead from the Marketo database
|
27
|
+
lead = client.get_lead_by_email("joe@example.com")
|
28
|
+
|
29
|
+
# Update a lead record
|
30
|
+
lead.set_attribute("Email", "joe-schmoe@example.com")
|
31
|
+
|
32
|
+
# Update a lead record with an attribute that isn't a string
|
33
|
+
lead.set_attribute("Activated", true, "Boolean") # [1]
|
34
|
+
|
35
|
+
# Sync the lead with Marketo
|
36
|
+
response = client.sync_lead_record(lead)
|
37
|
+
|
38
|
+
# Check if a lead is on a list
|
39
|
+
client.is_member_of_list?('The_List_Name', lead.idnum)
|
40
|
+
|
41
|
+
# Add a lead to a particular list
|
42
|
+
client.add_to_list('The_List_Name', lead.idnum)
|
43
|
+
|
44
|
+
# Remove a lead from a particular list
|
45
|
+
client.remove_from_list('The_List_Name', lead.idnum)
|
46
|
+
```
|
47
|
+
|
48
|
+
[1] Note that [the Marketo API does not let you create custom fields] (https://community.marketo.com/MarketoDiscussionDetail?id=90650000000PpyEAAS#j_id0:j_id2:j_id9:j_id10:apexideas:j_id248) at this time. In order to set a custom attribute through the API, it must first be added from the Admin interface.
|
49
|
+
_(Admin » Field Management » New Custom Field)_
|
data/Rakefile
ADDED
data/lib/markety/lead_record.rb
CHANGED
@@ -13,11 +13,19 @@ module Markety
|
|
13
13
|
# hydrates an instance from a savon hash returned form the marketo API
|
14
14
|
def self.from_hash(savon_hash)
|
15
15
|
lead_record = LeadRecord.new(savon_hash[:email], savon_hash[:id].to_i)
|
16
|
-
|
17
|
-
savon_hash[:lead_attribute_list]
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
|
17
|
+
unless savon_hash[:lead_attribute_list].nil?
|
18
|
+
if savon_hash[:lead_attribute_list][:attribute].kind_of? Hash
|
19
|
+
attributes = [savon_hash[:lead_attribute_list][:attribute]]
|
20
|
+
else
|
21
|
+
attributes = savon_hash[:lead_attribute_list][:attribute]
|
22
|
+
end
|
23
|
+
|
24
|
+
attributes.each do |attribute|
|
25
|
+
lead_record.set_attribute(attribute[:attr_name], attribute[:attr_value], attribute[:attr_type])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
21
29
|
lead_record
|
22
30
|
end
|
23
31
|
|
@@ -62,4 +70,4 @@ module Markety
|
|
62
70
|
@idnum == other.idnum
|
63
71
|
end
|
64
72
|
end
|
65
|
-
end
|
73
|
+
end
|
data/lib/markety/version.rb
CHANGED
data/markety.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'markety/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'markety'
|
8
|
+
s.version = Markety::VERSION
|
9
|
+
s.summary = 'Marketo SOAP API integration'
|
10
|
+
s.description = <<-DESC.strip
|
11
|
+
A client to allow easy integration with Marketo's SOAP API
|
12
|
+
DESC
|
13
|
+
s.authors = ['David Santoso']
|
14
|
+
s.email = ['david.e.santoso@gmail.com']
|
15
|
+
s.homepage = 'https://github.com/davidsantoso/markety'
|
16
|
+
s.license = 'MIT'
|
17
|
+
|
18
|
+
s.files = `git ls-files -z`.split("\x0")
|
19
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
21
|
+
s.require_paths = ['lib']
|
22
|
+
|
23
|
+
s.required_ruby_version = '>= 1.9.3'
|
24
|
+
|
25
|
+
s.add_development_dependency 'bundler', '~> 1.6'
|
26
|
+
s.add_development_dependency 'rake'
|
27
|
+
s.add_development_dependency 'rspec', '~> 2.3', '>= 2.3.0'
|
28
|
+
s.add_development_dependency 'rspec-nc'
|
29
|
+
s.add_development_dependency 'guard'
|
30
|
+
s.add_development_dependency 'guard-rspec'
|
31
|
+
s.add_development_dependency 'pry'
|
32
|
+
s.add_development_dependency 'pry-remote'
|
33
|
+
s.add_development_dependency 'pry-plus'
|
34
|
+
s.add_development_dependency 'coveralls'
|
35
|
+
|
36
|
+
s.add_runtime_dependency 'savon', '= 2.3.1'
|
37
|
+
s.add_runtime_dependency 'wasabi', '= 3.2.1'
|
38
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
ACCESS_KEY = 'ACCESS_KEY'
|
5
|
+
SECRET_KEY = 'SECRET_KEY'
|
6
|
+
|
7
|
+
describe AuthenticationHeader do
|
8
|
+
it "should set mktowsUserId to access key" do
|
9
|
+
header = Markety::AuthenticationHeader.new(ACCESS_KEY, SECRET_KEY)
|
10
|
+
header.get_mktows_user_id.should == ACCESS_KEY
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should set requestSignature" do
|
14
|
+
header = Markety::AuthenticationHeader.new(ACCESS_KEY, SECRET_KEY)
|
15
|
+
header.get_request_signature.should_not be_nil
|
16
|
+
header.get_request_signature.should_not == ''
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should set requestTimestamp in correct format" do
|
20
|
+
header = Markety::AuthenticationHeader.new(ACCESS_KEY, SECRET_KEY)
|
21
|
+
time = DateTime.new(1998, 1, 17, 20, 15, 1)
|
22
|
+
header.set_time(time)
|
23
|
+
header.get_request_timestamp().should == '1998-01-17T20:15:01+00:00'
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should calculate encrypted signature" do
|
27
|
+
# I got this example of the marketo API docs
|
28
|
+
|
29
|
+
access_key = 'bigcorp1_461839624B16E06BA2D663'
|
30
|
+
secret_key = '899756834129871744AAEE88DDCC77CDEEDEC1AAAD66'
|
31
|
+
|
32
|
+
header = Markety::AuthenticationHeader.new(access_key, secret_key)
|
33
|
+
header.set_time(DateTime.new(2010, 4, 9, 14, 4, 54, -7/24.0))
|
34
|
+
|
35
|
+
header.get_request_timestamp.should == '2010-04-09T14:04:54-07:00'
|
36
|
+
header.get_request_signature.should == 'ffbff4d4bef354807481e66dc7540f7890523a87'
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should cope if no date is given" do
|
40
|
+
header = Markety::AuthenticationHeader.new(ACCESS_KEY, SECRET_KEY)
|
41
|
+
expected = DateTime.now
|
42
|
+
actual = DateTime.parse(header.get_request_timestamp)
|
43
|
+
|
44
|
+
expected.year.should == actual.year
|
45
|
+
expected.hour.should == actual.hour
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should to_hash correctly" do
|
49
|
+
# I got this example from the marketo API docs
|
50
|
+
|
51
|
+
access_key = 'bigcorp1_461839624B16E06BA2D663'
|
52
|
+
secret_key = '899756834129871744AAEE88DDCC77CDEEDEC1AAAD66'
|
53
|
+
|
54
|
+
header = Markety::AuthenticationHeader.new(access_key, secret_key)
|
55
|
+
header.set_time(DateTime.new(2010, 4, 9, 14, 4, 55, -7/24.0))
|
56
|
+
|
57
|
+
header.to_hash.should == {"ns1:AuthenticationHeader" =>
|
58
|
+
{
|
59
|
+
'mktowsUserId' => header.get_mktows_user_id,
|
60
|
+
'requestSignature' => header.get_request_signature,
|
61
|
+
'requestTimestamp' => header.get_request_timestamp,
|
62
|
+
}
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
describe Client do
|
5
|
+
it 'should instantiate with a Savon client and authentication header' do
|
6
|
+
client = Client.new(double('savon_client'), double('authentication_header'))
|
7
|
+
client.class.should == Markety::Client
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
describe LeadKeyType do
|
5
|
+
it "should define the correct types" do
|
6
|
+
LeadKeyType::IDNUM.should == 'IDNUM'
|
7
|
+
LeadKeyType::COOKIE.should == 'COOKIE'
|
8
|
+
LeadKeyType::EMAIL.should == 'EMAIL'
|
9
|
+
LeadKeyType::LEADOWNEREMAIL.should == 'LEADOWNEREMAIL'
|
10
|
+
LeadKeyType::SFDCACCOUNTID.should == 'SFDCACCOUNTID'
|
11
|
+
LeadKeyType::SFDCCONTACTID.should == 'SFDCCONTACTID'
|
12
|
+
LeadKeyType::SFDCLEADID.should == 'SFDCLEADID'
|
13
|
+
LeadKeyType::SFDCLEADOWNERID.should == 'SFDCLEADOWNERID'
|
14
|
+
LeadKeyType::SFDCOPPTYID.should == 'SFDCOPPTYID'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe LeadKey do
|
19
|
+
it "should store type and value on construction" do
|
20
|
+
KEY_VALUE = 'a value'
|
21
|
+
KEY_TYPE = LeadKeyType::IDNUM
|
22
|
+
lead_key = LeadKey.new(KEY_TYPE, KEY_VALUE)
|
23
|
+
lead_key.key_type.should == KEY_TYPE
|
24
|
+
lead_key.key_value.should == KEY_VALUE
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should to_hash correctly" do
|
28
|
+
KEY_VALUE = 'a value'
|
29
|
+
KEY_TYPE = LeadKeyType::IDNUM
|
30
|
+
lead_key = LeadKey.new(KEY_TYPE, KEY_VALUE)
|
31
|
+
|
32
|
+
lead_key.to_hash.should == {
|
33
|
+
"keyType" => KEY_TYPE,
|
34
|
+
"keyValue" => KEY_VALUE
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
EMAIL = 'some@email.com'
|
5
|
+
IDNUM = 93480938
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
describe LeadRecord do
|
10
|
+
it "should store the idnum" do
|
11
|
+
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
12
|
+
lead_record.idnum.should == IDNUM
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should store the email" do
|
16
|
+
LeadRecord.new(EMAIL, IDNUM).email.should == EMAIL
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should implement == sensibly" do
|
20
|
+
lead_record1 = LeadRecord.new(EMAIL, IDNUM)
|
21
|
+
lead_record1.set_attribute('favourite color', 'red')
|
22
|
+
lead_record1.set_attribute('age', '100')
|
23
|
+
|
24
|
+
lead_record2 = LeadRecord.new(EMAIL, IDNUM)
|
25
|
+
lead_record2.set_attribute('favourite color', 'red')
|
26
|
+
lead_record2.set_attribute('age', '100')
|
27
|
+
|
28
|
+
lead_record1.should == lead_record2
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should store when attributes are set" do
|
32
|
+
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
33
|
+
lead_record.set_attribute('favourite color', 'red')
|
34
|
+
lead_record.get_attribute('favourite color').should == 'red'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should store when attributes are updated" do
|
38
|
+
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
39
|
+
lead_record.set_attribute('favourite color', 'red')
|
40
|
+
lead_record.set_attribute('favourite color', 'green')
|
41
|
+
lead_record.get_attribute('favourite color').should == 'green'
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should yield all attributes through each_attribute_pair" do
|
45
|
+
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
46
|
+
lead_record.set_attribute('favourite color', 'red')
|
47
|
+
lead_record.set_attribute('favourite color', 'green')
|
48
|
+
lead_record.set_attribute('age', '99')
|
49
|
+
|
50
|
+
pairs = []
|
51
|
+
lead_record.each_attribute_pair do |attribute_name, attribute_value|
|
52
|
+
pairs << [attribute_name, attribute_value]
|
53
|
+
end
|
54
|
+
|
55
|
+
pairs.size.should == 3
|
56
|
+
pairs.should include(['favourite color', 'green'])
|
57
|
+
pairs.should include(['age', '99'])
|
58
|
+
pairs.should include(['Email', EMAIL])
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should be instantiable from savon hash with no attributes' do
|
62
|
+
savon_hash = {
|
63
|
+
:id => IDNUM,
|
64
|
+
:email => EMAIL,
|
65
|
+
:foreign_sys_person_id => nil,
|
66
|
+
:foreign_sys_type => nil,
|
67
|
+
:lead_attribute_list => nil
|
68
|
+
}
|
69
|
+
|
70
|
+
actual = LeadRecord.from_hash(savon_hash)
|
71
|
+
expected = LeadRecord.new(EMAIL, IDNUM)
|
72
|
+
|
73
|
+
actual.should == expected
|
74
|
+
end
|
75
|
+
|
76
|
+
# When there is only one attribute, Marketo returns a Hash, not an Array
|
77
|
+
it 'should be instantiable from savon hash with only one attribute' do
|
78
|
+
savon_hash = {
|
79
|
+
:id => IDNUM,
|
80
|
+
:email => EMAIL,
|
81
|
+
:foreign_sys_person_id => nil,
|
82
|
+
:foreign_sys_type => nil,
|
83
|
+
:lead_attribute_list =>
|
84
|
+
{:attribute => { :attr_name => 'FirstName', :attr_value => 'Yaya', :attr_type => 'string'}}
|
85
|
+
}
|
86
|
+
|
87
|
+
actual = LeadRecord.from_hash(savon_hash)
|
88
|
+
|
89
|
+
expected = LeadRecord.new(EMAIL, IDNUM)
|
90
|
+
expected.set_attribute('FirstName', 'Yaya')
|
91
|
+
|
92
|
+
actual.should == expected
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should be instantiable from a savon hash" do
|
96
|
+
savon_hash = {
|
97
|
+
:email => EMAIL,
|
98
|
+
:foreign_sys_type => nil,
|
99
|
+
:lead_attribute_list => {
|
100
|
+
:attribute => [
|
101
|
+
{ :attr_name => 'Company', :attr_type => 'string', :attr_value => 'Yaya'},
|
102
|
+
{ :attr_name => 'FirstName', :attr_type => 'string', :attr_value => 'James'},
|
103
|
+
{ :attr_name => 'LastName', :attr_type => 'string', :attr_value => 'O\'Brien'}
|
104
|
+
]
|
105
|
+
},
|
106
|
+
:foreign_sys_person_id => nil,
|
107
|
+
:id => IDNUM
|
108
|
+
}
|
109
|
+
|
110
|
+
actual = LeadRecord.from_hash(savon_hash)
|
111
|
+
|
112
|
+
expected = LeadRecord.new(EMAIL, IDNUM)
|
113
|
+
expected.set_attribute('Company', 'Yaya')
|
114
|
+
expected.set_attribute('FirstName', 'James')
|
115
|
+
expected.set_attribute('LastName', 'O\'Brien')
|
116
|
+
|
117
|
+
actual.should == expected
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markety
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Santoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,12 +58,148 @@ dependencies:
|
|
58
58
|
- - ! '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 2.3.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec-nc
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: guard
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: guard-rspec
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: pry
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: pry-remote
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: pry-plus
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: coveralls
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ! '>='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: savon
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - '='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 2.3.1
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - '='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 2.3.1
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: wasabi
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - '='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 3.2.1
|
180
|
+
type: :runtime
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - '='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: 3.2.1
|
61
187
|
description: A client to allow easy integration with Marketo's SOAP API
|
62
|
-
email:
|
188
|
+
email:
|
189
|
+
- david.e.santoso@gmail.com
|
63
190
|
executables: []
|
64
191
|
extensions: []
|
65
192
|
extra_rdoc_files: []
|
66
193
|
files:
|
194
|
+
- .coveralls.yml
|
195
|
+
- .gitignore
|
196
|
+
- .rspec
|
197
|
+
- .travis.yml
|
198
|
+
- Gemfile
|
199
|
+
- Guardfile
|
200
|
+
- LICENCE
|
201
|
+
- README.md
|
202
|
+
- Rakefile
|
67
203
|
- lib/markety.rb
|
68
204
|
- lib/markety/authentication_header.rb
|
69
205
|
- lib/markety/client.rb
|
@@ -71,6 +207,12 @@ files:
|
|
71
207
|
- lib/markety/lead_key.rb
|
72
208
|
- lib/markety/lead_record.rb
|
73
209
|
- lib/markety/version.rb
|
210
|
+
- markety.gemspec
|
211
|
+
- spec/markety/authentication_header_spec.rb
|
212
|
+
- spec/markety/client_spec.rb
|
213
|
+
- spec/markety/lead_key_spec.rb
|
214
|
+
- spec/markety/lead_record_spec.rb
|
215
|
+
- spec/spec_helper.rb
|
74
216
|
homepage: https://github.com/davidsantoso/markety
|
75
217
|
licenses:
|
76
218
|
- MIT
|
@@ -95,4 +237,9 @@ rubygems_version: 2.2.2
|
|
95
237
|
signing_key:
|
96
238
|
specification_version: 4
|
97
239
|
summary: Marketo SOAP API integration
|
98
|
-
test_files:
|
240
|
+
test_files:
|
241
|
+
- spec/markety/authentication_header_spec.rb
|
242
|
+
- spec/markety/client_spec.rb
|
243
|
+
- spec/markety/lead_key_spec.rb
|
244
|
+
- spec/markety/lead_record_spec.rb
|
245
|
+
- spec/spec_helper.rb
|