markety 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +33 -2
- data/lib/markety.rb +1 -0
- data/lib/markety/client.rb +2 -0
- data/lib/markety/command.rb +2 -0
- data/lib/markety/command/get_custom_object.rb +18 -0
- data/lib/markety/command/sync_custom_object.rb +15 -0
- data/lib/markety/custom_object.rb +49 -0
- data/lib/markety/response.rb +2 -0
- data/lib/markety/response/get_custom_object_response.rb +39 -0
- data/lib/markety/response/response_factory.rb +4 -0
- data/lib/markety/response/sync_custom_object_response.rb +43 -0
- data/lib/markety/response/sync_lead_response.rb +1 -1
- data/lib/markety/version.rb +1 -1
- data/markety.gemspec +3 -8
- data/spec/fixtures/custom_objects/get_custom_objects/multiple_custom_objects_found.xml +201 -0
- data/spec/fixtures/custom_objects/get_custom_objects/no_custom_objects_found.xml +14 -0
- data/spec/fixtures/custom_objects/get_custom_objects/one_custom_object_found.xml +46 -0
- data/spec/fixtures/custom_objects/sync_custom_objects/invalid_object_name.xml +15 -0
- data/spec/fixtures/custom_objects/sync_custom_objects/successful_sync.xml +28 -0
- data/spec/fixtures/custom_objects/sync_custom_objects/unknown_attribute.xml +28 -0
- data/spec/markety/client_spec.rb +0 -2
- data/spec/markety/command/get_custom_object_spec.rb +29 -0
- data/spec/markety/command/sync_custom_object_spec.rb +30 -0
- data/spec/markety/custom_object_spec.rb +80 -0
- data/spec/markety/lead_key_spec.rb +1 -1
- data/spec/markety/response/get_custom_object_response_spec.rb +75 -0
- data/spec/markety/response/sync_custom_object_response_spec.rb +72 -0
- data/spec/spec_helper.rb +0 -3
- metadata +39 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 579d0ef7b9f8d678e9e8b1d8933f75bb5766a84a
|
4
|
+
data.tar.gz: 2b5f5c737cd5337783c8c57942c105bfcb75bc3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f751d4ffc7fe0d458f6bcecd4b849300fa29ede30c168a156c3cff634c8d84c1aa77307655023cbe9881af1b66eef49e4067d6faf7686ca6eed0aaf065485ec7
|
7
|
+
data.tar.gz: 5aac57074bcb70e5952d60cfe7cc689f36de923de0b7a1358f27af1cfde7d50b655009e59c1aa517997b5f6b08c916df6e9af8cedfb6958c6f8a8585f9a0c78b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -53,7 +53,7 @@ Once you're ready to sync back, just tell Markety how you'd like it to sync.
|
|
53
53
|
There are currently 3 supported methods, "EMAIL", "MARKETO_ID" and "FOREIGN_ID"
|
54
54
|
```
|
55
55
|
# Sync the lead with Marketo
|
56
|
-
response = client.
|
56
|
+
response = client.sync_lead(lead, "EMAIL")
|
57
57
|
```
|
58
58
|
|
59
59
|
There are a few available list operations available at the moment. Be sure to pass in the lead
|
@@ -70,7 +70,7 @@ client.add_to_list('The_List_Name', lead.idnum).list_operation_status #true if s
|
|
70
70
|
client.remove_from_list('The_List_Name', lead.idnum).list_operation_status #true if successful removal
|
71
71
|
```
|
72
72
|
|
73
|
-
|
73
|
+
If you would like to create a lead in Marketo, you can use the sync lead method the same way
|
74
74
|
you would use the sync lead to update a lead. Just start by instantiating a Markety::Lead.
|
75
75
|
```ruby
|
76
76
|
new_lead = Markety::Lead.new
|
@@ -83,6 +83,37 @@ Be sure you have the correct attribute fields. You can find those in your Market
|
|
83
83
|
[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.
|
84
84
|
_(Admin » Field Management » New Custom Field)_
|
85
85
|
|
86
|
+
### Custom Objects
|
87
|
+
You can also create and fetch Marketo custom object instances. Marketo custom objects allow you to
|
88
|
+
have a one-to-many relationship between your marketo leads and the custom object. You will need to
|
89
|
+
have custom objects set up in your account before you can create or get them.
|
90
|
+
|
91
|
+
Each custom object has its own unique key and foreign key which can be used as identifiers to fetch
|
92
|
+
the object. You can find all the custom objects that belong to a particular lead and/or find a custom
|
93
|
+
object with a specific id.
|
94
|
+
```ruby
|
95
|
+
# getting a custom object
|
96
|
+
custom_object = client.get_custom_object_by_keys("Roadshow", {"MKTOID" => 1090177, "rid" => 123456})
|
97
|
+
```
|
98
|
+
|
99
|
+
You can create your own custom object easily by specifying the object type name, keys and attributes
|
100
|
+
```ruby
|
101
|
+
# creating a custom object
|
102
|
+
custom_object = Markety::CustomObject.new(
|
103
|
+
object_type_name: "Roadshow",
|
104
|
+
keys: {"MKTOID" => 1090177, "rid" => "rid1"},
|
105
|
+
attributes: {"city" => "SanMateo", "zip" => 94404 })
|
106
|
+
```
|
107
|
+
|
108
|
+
Once you've created your custom object, you can sync it up and specify either the "INSERT", "UPDATE"
|
109
|
+
or "UPSERT" operations (the default is "UPSERT" if no operation is specified).
|
110
|
+
```ruby
|
111
|
+
# syncing a custom object
|
112
|
+
response = client.sync_custom_object(custom_object, "UPSERT")
|
113
|
+
```
|
114
|
+
|
115
|
+
For more information about custom objects, check out http://developers.marketo.com/documentation/soap/custom-object-operations/
|
116
|
+
|
86
117
|
## Options
|
87
118
|
|
88
119
|
```ruby
|
data/lib/markety.rb
CHANGED
data/lib/markety/client.rb
CHANGED
@@ -6,6 +6,8 @@ module Markety
|
|
6
6
|
class Client
|
7
7
|
include Markety::Command::GetLead
|
8
8
|
include Markety::Command::SyncLead
|
9
|
+
include Markety::Command::GetCustomObject
|
10
|
+
include Markety::Command::SyncCustomObject
|
9
11
|
include Markety::Command::ListOperation
|
10
12
|
|
11
13
|
attr_reader :target_workspace
|
data/lib/markety/command.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Markety
|
2
|
+
module Command
|
3
|
+
module GetCustomObject
|
4
|
+
|
5
|
+
# keys can be a hash or an array of hashes
|
6
|
+
def get_custom_object_by_keys(object_type_name, keys)
|
7
|
+
send_request(:get_custom_objects, {"objTypeName" => object_type_name, "customObjKeyList" => {"attribute" => convert_keys(keys)}})
|
8
|
+
end
|
9
|
+
|
10
|
+
def convert_keys(keys)
|
11
|
+
keys.map do |key, value|
|
12
|
+
{"attrName" => key, "attrValue" => value}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Markety
|
2
|
+
module Command
|
3
|
+
module SyncCustomObject
|
4
|
+
def sync_custom_object(custom_object, operation="UPSERT")
|
5
|
+
send_request(:sync_custom_objects,
|
6
|
+
{
|
7
|
+
"objTypeName" => custom_object.object_type_name,
|
8
|
+
"operation" => operation,
|
9
|
+
"customObjList" => custom_object.to_sync_custom_object_hash
|
10
|
+
}
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Markety
|
2
|
+
class CustomObject
|
3
|
+
|
4
|
+
attr_accessor :object_type_name, :keys, :attributes
|
5
|
+
|
6
|
+
def initialize(object_type_name: "", keys: {}, attributes: {})
|
7
|
+
@object_type_name = object_type_name
|
8
|
+
@keys = keys
|
9
|
+
@attributes = attributes
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_key(key_name)
|
13
|
+
@keys[key_name]
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_sync_custom_object_hash
|
17
|
+
{
|
18
|
+
"customObj" =>
|
19
|
+
{
|
20
|
+
"customObjKeyList" => key_list,
|
21
|
+
"customObjAttributeList" => attribute_list
|
22
|
+
}
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.from_marketo_hash(object_type_name, marketo_hash)
|
27
|
+
keys = {}
|
28
|
+
attributes = {}
|
29
|
+
marketo_hash[:custom_obj_key_list][:attribute].each{|attribute| keys[attribute[:attr_name]] = attribute[:attr_value]}
|
30
|
+
marketo_hash[:custom_obj_attribute_list][:attribute].each{|attribute| attributes[attribute[:attr_name]] = attribute[:attr_value]} if marketo_hash[:custom_obj_attribute_list]
|
31
|
+
new(object_type_name: object_type_name, keys: keys, attributes: attributes)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def key_list
|
37
|
+
attributes_hash(keys)
|
38
|
+
end
|
39
|
+
|
40
|
+
def attribute_list
|
41
|
+
attributes_hash(attributes)
|
42
|
+
end
|
43
|
+
|
44
|
+
def attributes_hash(attributes)
|
45
|
+
{"attribute" => attributes.map{|key, value| {"attrName" => key, "attrValue" => value}}}
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/markety/response.rb
CHANGED
@@ -2,7 +2,9 @@ require 'markety/response/response_factory'
|
|
2
2
|
|
3
3
|
require 'markety/response/generic_response'
|
4
4
|
require 'markety/response/get_lead_response'
|
5
|
+
require 'markety/response/get_custom_object_response'
|
5
6
|
require 'markety/response/sync_lead_response'
|
7
|
+
require 'markety/response/sync_custom_object_response'
|
6
8
|
require 'markety/response/list_operation_response'
|
7
9
|
|
8
10
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Markety
|
2
|
+
module Response
|
3
|
+
class GetCustomObjectResponse < GenericResponse
|
4
|
+
def initialize(response)
|
5
|
+
super(:get_custom_object_response, response)
|
6
|
+
end
|
7
|
+
|
8
|
+
def custom_objects
|
9
|
+
@custom_objects ||= begin
|
10
|
+
custom_object_list.map do |custom_obj_hash|
|
11
|
+
CustomObject.from_marketo_hash(object_type_name, custom_obj_hash)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def custom_object
|
17
|
+
custom_objects.first
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def custom_object_list
|
23
|
+
[custom_object_list_hash.fetch(:custom_obj, [])].flatten
|
24
|
+
end
|
25
|
+
|
26
|
+
def custom_object_list_hash
|
27
|
+
result_hash[:custom_obj_list] || {}
|
28
|
+
end
|
29
|
+
|
30
|
+
def object_type_name
|
31
|
+
result_hash.fetch(:obj_type_name, {})
|
32
|
+
end
|
33
|
+
|
34
|
+
def result_hash
|
35
|
+
to_hash.fetch(:success_get_custom_objects, {}).fetch(:result, {})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -17,6 +17,10 @@ module Markety
|
|
17
17
|
SyncLeadResponse.new(savon_response)
|
18
18
|
when :list_operation
|
19
19
|
ListOperationResponse.new(savon_response)
|
20
|
+
when :get_custom_objects
|
21
|
+
GetCustomObjectResponse.new(savon_response)
|
22
|
+
when :sync_custom_objects
|
23
|
+
SyncCustomObjectResponse.new(savon_response)
|
20
24
|
else
|
21
25
|
GenericResponse.new(cmd_type,savon_response)
|
22
26
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Markety
|
2
|
+
module Response
|
3
|
+
class SyncCustomObjectResponse < GenericResponse
|
4
|
+
|
5
|
+
attr_accessor :status
|
6
|
+
|
7
|
+
def initialize(response)
|
8
|
+
super(:sync_custom_objects_response, response)
|
9
|
+
end
|
10
|
+
|
11
|
+
def success?
|
12
|
+
@success && !failed?
|
13
|
+
end
|
14
|
+
|
15
|
+
def status
|
16
|
+
@status ||= custom_obj_hash[:status]
|
17
|
+
end
|
18
|
+
|
19
|
+
def error_message
|
20
|
+
@error_message ||= custom_obj_hash[:error]
|
21
|
+
end
|
22
|
+
|
23
|
+
def updated_custom_object
|
24
|
+
CustomObject.from_marketo_hash(object_type_name, custom_obj_hash) if success?
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def failed?
|
30
|
+
status == "FAILED"
|
31
|
+
end
|
32
|
+
|
33
|
+
def object_type_name
|
34
|
+
@object_type_name ||= custom_obj_hash[:obj_type_name]
|
35
|
+
end
|
36
|
+
|
37
|
+
def custom_obj_hash
|
38
|
+
to_hash[:success_sync_custom_objects][:result][:sync_custom_obj_status_list][:sync_custom_obj_status]
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/markety/version.rb
CHANGED
data/markety.gemspec
CHANGED
@@ -20,19 +20,14 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
21
21
|
s.require_paths = ['lib']
|
22
22
|
|
23
|
-
s.required_ruby_version = '>=
|
23
|
+
s.required_ruby_version = '>= 2.0.0'
|
24
24
|
|
25
25
|
s.add_development_dependency 'bundler', '~> 1.6'
|
26
26
|
s.add_development_dependency 'rake'
|
27
27
|
s.add_development_dependency 'rspec', '~> 2.3', '>= 2.3.0'
|
28
28
|
s.add_development_dependency 'rspec-nc'
|
29
|
-
s.add_development_dependency 'guard'
|
30
|
-
s.add_development_dependency 'guard-rspec'
|
31
29
|
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
30
|
|
36
|
-
s.add_runtime_dependency 'savon', '
|
37
|
-
s.add_runtime_dependency 'wasabi', '
|
31
|
+
s.add_runtime_dependency 'savon', '~> 2.3'
|
32
|
+
s.add_runtime_dependency 'wasabi', '~> 3.2'
|
38
33
|
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://www.marketo.com/mktows/">
|
3
|
+
<SOAP-ENV:Body>
|
4
|
+
<ns1:successGetCustomObjects>
|
5
|
+
<result>
|
6
|
+
<objTypeName>Roadshow</objTypeName>
|
7
|
+
<returnCount>6</returnCount>
|
8
|
+
<remainingCount>0</remainingCount>
|
9
|
+
<newStreamPosition>{"ky":["1090177"],"os":6}</newStreamPosition>
|
10
|
+
<customObjList>
|
11
|
+
<customObj>
|
12
|
+
<customObjKeyList>
|
13
|
+
<attribute>
|
14
|
+
<attrName>MKTOID</attrName>
|
15
|
+
<attrType xsi:nil="true" />
|
16
|
+
<attrValue>1090177</attrValue>
|
17
|
+
</attribute>
|
18
|
+
<attribute>
|
19
|
+
<attrName>rid</attrName>
|
20
|
+
<attrType xsi:nil="true" />
|
21
|
+
<attrValue>123456</attrValue>
|
22
|
+
</attribute>
|
23
|
+
</customObjKeyList>
|
24
|
+
<customObjAttributeList>
|
25
|
+
<attribute>
|
26
|
+
<attrName>city</attrName>
|
27
|
+
<attrType xsi:nil="true" />
|
28
|
+
<attrValue>city4</attrValue>
|
29
|
+
</attribute>
|
30
|
+
<attribute>
|
31
|
+
<attrName>state</attrName>
|
32
|
+
<attrType xsi:nil="true" />
|
33
|
+
<attrValue>state4</attrValue>
|
34
|
+
</attribute>
|
35
|
+
<attribute>
|
36
|
+
<attrName>zip</attrName>
|
37
|
+
<attrType xsi:nil="true" />
|
38
|
+
<attrValue>zip4</attrValue>
|
39
|
+
</attribute>
|
40
|
+
</customObjAttributeList>
|
41
|
+
</customObj>
|
42
|
+
<customObj>
|
43
|
+
<customObjKeyList>
|
44
|
+
<attribute>
|
45
|
+
<attrName>MKTOID</attrName>
|
46
|
+
<attrType xsi:nil="true" />
|
47
|
+
<attrValue>1090177</attrValue>
|
48
|
+
</attribute>
|
49
|
+
<attribute>
|
50
|
+
<attrName>rid</attrName>
|
51
|
+
<attrType xsi:nil="true" />
|
52
|
+
<attrValue>rid0</attrValue>
|
53
|
+
</attribute>
|
54
|
+
</customObjKeyList>
|
55
|
+
<customObjAttributeList>
|
56
|
+
<attribute>
|
57
|
+
<attrName>city</attrName>
|
58
|
+
<attrType xsi:nil="true" />
|
59
|
+
<attrValue>city0</attrValue>
|
60
|
+
</attribute>
|
61
|
+
<attribute>
|
62
|
+
<attrName>state</attrName>
|
63
|
+
<attrType xsi:nil="true" />
|
64
|
+
<attrValue>state0</attrValue>
|
65
|
+
</attribute>
|
66
|
+
<attribute>
|
67
|
+
<attrName>zip</attrName>
|
68
|
+
<attrType xsi:nil="true" />
|
69
|
+
<attrValue>zip0</attrValue>
|
70
|
+
</attribute>
|
71
|
+
</customObjAttributeList>
|
72
|
+
</customObj>
|
73
|
+
<customObj>
|
74
|
+
<customObjKeyList>
|
75
|
+
<attribute>
|
76
|
+
<attrName>MKTOID</attrName>
|
77
|
+
<attrType xsi:nil="true" />
|
78
|
+
<attrValue>1090177</attrValue>
|
79
|
+
</attribute>
|
80
|
+
<attribute>
|
81
|
+
<attrName>rid</attrName>
|
82
|
+
<attrType xsi:nil="true" />
|
83
|
+
<attrValue>rid1</attrValue>
|
84
|
+
</attribute>
|
85
|
+
</customObjKeyList>
|
86
|
+
<customObjAttributeList>
|
87
|
+
<attribute>
|
88
|
+
<attrName>city</attrName>
|
89
|
+
<attrType xsi:nil="true" />
|
90
|
+
<attrValue>SanMateo</attrValue>
|
91
|
+
</attribute>
|
92
|
+
<attribute>
|
93
|
+
<attrName>state</attrName>
|
94
|
+
<attrType xsi:nil="true" />
|
95
|
+
<attrValue>California</attrValue>
|
96
|
+
</attribute>
|
97
|
+
<attribute>
|
98
|
+
<attrName>zip</attrName>
|
99
|
+
<attrType xsi:nil="true" />
|
100
|
+
<attrValue>94404</attrValue>
|
101
|
+
</attribute>
|
102
|
+
</customObjAttributeList>
|
103
|
+
</customObj>
|
104
|
+
<customObj>
|
105
|
+
<customObjKeyList>
|
106
|
+
<attribute>
|
107
|
+
<attrName>MKTOID</attrName>
|
108
|
+
<attrType xsi:nil="true" />
|
109
|
+
<attrValue>1090177</attrValue>
|
110
|
+
</attribute>
|
111
|
+
<attribute>
|
112
|
+
<attrName>rid</attrName>
|
113
|
+
<attrType xsi:nil="true" />
|
114
|
+
<attrValue>rid2</attrValue>
|
115
|
+
</attribute>
|
116
|
+
</customObjKeyList>
|
117
|
+
<customObjAttributeList>
|
118
|
+
<attribute>
|
119
|
+
<attrName>city</attrName>
|
120
|
+
<attrType xsi:nil="true" />
|
121
|
+
<attrValue>city2</attrValue>
|
122
|
+
</attribute>
|
123
|
+
<attribute>
|
124
|
+
<attrName>state</attrName>
|
125
|
+
<attrType xsi:nil="true" />
|
126
|
+
<attrValue>state2</attrValue>
|
127
|
+
</attribute>
|
128
|
+
<attribute>
|
129
|
+
<attrName>zip</attrName>
|
130
|
+
<attrType xsi:nil="true" />
|
131
|
+
<attrValue>zip2</attrValue>
|
132
|
+
</attribute>
|
133
|
+
</customObjAttributeList>
|
134
|
+
</customObj>
|
135
|
+
<customObj>
|
136
|
+
<customObjKeyList>
|
137
|
+
<attribute>
|
138
|
+
<attrName>MKTOID</attrName>
|
139
|
+
<attrType xsi:nil="true" />
|
140
|
+
<attrValue>1090177</attrValue>
|
141
|
+
</attribute>
|
142
|
+
<attribute>
|
143
|
+
<attrName>rid</attrName>
|
144
|
+
<attrType xsi:nil="true" />
|
145
|
+
<attrValue>rid3</attrValue>
|
146
|
+
</attribute>
|
147
|
+
</customObjKeyList>
|
148
|
+
<customObjAttributeList>
|
149
|
+
<attribute>
|
150
|
+
<attrName>city</attrName>
|
151
|
+
<attrType xsi:nil="true" />
|
152
|
+
<attrValue>city3</attrValue>
|
153
|
+
</attribute>
|
154
|
+
<attribute>
|
155
|
+
<attrName>state</attrName>
|
156
|
+
<attrType xsi:nil="true" />
|
157
|
+
<attrValue>state3</attrValue>
|
158
|
+
</attribute>
|
159
|
+
<attribute>
|
160
|
+
<attrName>zip</attrName>
|
161
|
+
<attrType xsi:nil="true" />
|
162
|
+
<attrValue>zip3</attrValue>
|
163
|
+
</attribute>
|
164
|
+
</customObjAttributeList>
|
165
|
+
</customObj>
|
166
|
+
<customObj>
|
167
|
+
<customObjKeyList>
|
168
|
+
<attribute>
|
169
|
+
<attrName>MKTOID</attrName>
|
170
|
+
<attrType xsi:nil="true" />
|
171
|
+
<attrValue>1090177</attrValue>
|
172
|
+
</attribute>
|
173
|
+
<attribute>
|
174
|
+
<attrName>rid</attrName>
|
175
|
+
<attrType xsi:nil="true" />
|
176
|
+
<attrValue>rid4</attrValue>
|
177
|
+
</attribute>
|
178
|
+
</customObjKeyList>
|
179
|
+
<customObjAttributeList>
|
180
|
+
<attribute>
|
181
|
+
<attrName>city</attrName>
|
182
|
+
<attrType xsi:nil="true" />
|
183
|
+
<attrValue>city4</attrValue>
|
184
|
+
</attribute>
|
185
|
+
<attribute>
|
186
|
+
<attrName>state</attrName>
|
187
|
+
<attrType xsi:nil="true" />
|
188
|
+
<attrValue>state4</attrValue>
|
189
|
+
</attribute>
|
190
|
+
<attribute>
|
191
|
+
<attrName>zip</attrName>
|
192
|
+
<attrType xsi:nil="true" />
|
193
|
+
<attrValue>zip4</attrValue>
|
194
|
+
</attribute>
|
195
|
+
</customObjAttributeList>
|
196
|
+
</customObj>
|
197
|
+
</customObjList>
|
198
|
+
</result>
|
199
|
+
</ns1:successGetCustomObjects>
|
200
|
+
</SOAP-ENV:Body>
|
201
|
+
</SOAP-ENV:Envelope>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.marketo.com/mktows/">
|
3
|
+
<SOAP-ENV:Body>
|
4
|
+
<ns1:successGetCustomObjects>
|
5
|
+
<result>
|
6
|
+
<objTypeName>roadshow</objTypeName>
|
7
|
+
<returnCount>0</returnCount>
|
8
|
+
<remainingCount>0</remainingCount>
|
9
|
+
<newStreamPosition>{"ky":["123"],"os":0}</newStreamPosition>
|
10
|
+
<customObjList/>
|
11
|
+
</result>
|
12
|
+
</ns1:successGetCustomObjects>
|
13
|
+
</SOAP-ENV:Body>
|
14
|
+
</SOAP-ENV:Envelope>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://www.marketo.com/mktows/">
|
3
|
+
<SOAP-ENV:Body>
|
4
|
+
<ns1:successGetCustomObjects>
|
5
|
+
<result>
|
6
|
+
<objTypeName>Roadshow</objTypeName>
|
7
|
+
<returnCount>6</returnCount>
|
8
|
+
<remainingCount>0</remainingCount>
|
9
|
+
<newStreamPosition>{"ky":["1090177"],"os":6}</newStreamPosition>
|
10
|
+
<customObjList>
|
11
|
+
<customObj>
|
12
|
+
<customObjKeyList>
|
13
|
+
<attribute>
|
14
|
+
<attrName>MKTOID</attrName>
|
15
|
+
<attrType xsi:nil="true" />
|
16
|
+
<attrValue>1090177</attrValue>
|
17
|
+
</attribute>
|
18
|
+
<attribute>
|
19
|
+
<attrName>rid</attrName>
|
20
|
+
<attrType xsi:nil="true" />
|
21
|
+
<attrValue>123456</attrValue>
|
22
|
+
</attribute>
|
23
|
+
</customObjKeyList>
|
24
|
+
<customObjAttributeList>
|
25
|
+
<attribute>
|
26
|
+
<attrName>city</attrName>
|
27
|
+
<attrType xsi:nil="true" />
|
28
|
+
<attrValue>city4</attrValue>
|
29
|
+
</attribute>
|
30
|
+
<attribute>
|
31
|
+
<attrName>state</attrName>
|
32
|
+
<attrType xsi:nil="true" />
|
33
|
+
<attrValue>state4</attrValue>
|
34
|
+
</attribute>
|
35
|
+
<attribute>
|
36
|
+
<attrName>zip</attrName>
|
37
|
+
<attrType xsi:nil="true" />
|
38
|
+
<attrValue>zip4</attrValue>
|
39
|
+
</attribute>
|
40
|
+
</customObjAttributeList>
|
41
|
+
</customObj>
|
42
|
+
</customObjList>
|
43
|
+
</result>
|
44
|
+
</ns1:successGetCustomObjects>
|
45
|
+
</SOAP-ENV:Body>
|
46
|
+
</SOAP-ENV:Envelope>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
|
2
|
+
<SOAP-ENV:Body>
|
3
|
+
<SOAP-ENV:Fault>
|
4
|
+
<faultcode>SOAP-ENV:Client</faultcode>
|
5
|
+
<faultstring>20110 - Input error</faultstring>
|
6
|
+
<detail>
|
7
|
+
<ns1:serviceException xmlns:ns1="http://www.marketo.com/mktows/">
|
8
|
+
<name>mktServiceException</name>
|
9
|
+
<message>Object name is not valid (20110)</message>
|
10
|
+
<code>20110</code>
|
11
|
+
</ns1:serviceException>
|
12
|
+
</detail>
|
13
|
+
</SOAP-ENV:Fault>
|
14
|
+
</SOAP-ENV:Body>
|
15
|
+
</SOAP-ENV:Envelope>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://www.marketo.com/mktows/">
|
3
|
+
<SOAP-ENV:Body>
|
4
|
+
<ns1:successSyncCustomObjects>
|
5
|
+
<result>
|
6
|
+
<syncCustomObjStatusList>
|
7
|
+
<syncCustomObjStatus>
|
8
|
+
<objTypeName>Roadshow</objTypeName>
|
9
|
+
<customObjKeyList>
|
10
|
+
<attribute>
|
11
|
+
<attrName>MKTOID</attrName>
|
12
|
+
<attrType xsi:nil="true" />
|
13
|
+
<attrValue>1090177</attrValue>
|
14
|
+
</attribute>
|
15
|
+
<attribute>
|
16
|
+
<attrName>rid</attrName>
|
17
|
+
<attrType xsi:nil="true" />
|
18
|
+
<attrValue>rid1</attrValue>
|
19
|
+
</attribute>
|
20
|
+
</customObjKeyList>
|
21
|
+
<status>UPDATED</status>
|
22
|
+
<error xsi:nil="true" />
|
23
|
+
</syncCustomObjStatus>
|
24
|
+
</syncCustomObjStatusList>
|
25
|
+
</result>
|
26
|
+
</ns1:successSyncCustomObjects>
|
27
|
+
</SOAP-ENV:Body>
|
28
|
+
</SOAP-ENV:Envelope>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://www.marketo.com/mktows/">
|
3
|
+
<SOAP-ENV:Body>
|
4
|
+
<ns1:successSyncCustomObjects>
|
5
|
+
<result>
|
6
|
+
<syncCustomObjStatusList>
|
7
|
+
<syncCustomObjStatus>
|
8
|
+
<objTypeName>roadshow</objTypeName>
|
9
|
+
<customObjKeyList>
|
10
|
+
<attribute>
|
11
|
+
<attrName>MKTOID</attrName>
|
12
|
+
<attrType xsi:nil="true"/>
|
13
|
+
<attrValue>542065</attrValue>
|
14
|
+
</attribute>
|
15
|
+
<attribute>
|
16
|
+
<attrName>rid</attrName>
|
17
|
+
<attrType xsi:nil="true"/>
|
18
|
+
<attrValue>345</attrValue>
|
19
|
+
</attribute>
|
20
|
+
</customObjKeyList>
|
21
|
+
<status>FAILED</status>
|
22
|
+
<error>Unknown name attribute list: nameasdf</error>
|
23
|
+
</syncCustomObjStatus>
|
24
|
+
</syncCustomObjStatusList>
|
25
|
+
</result>
|
26
|
+
</ns1:successSyncCustomObjects>
|
27
|
+
</SOAP-ENV:Body>
|
28
|
+
</SOAP-ENV:Envelope>
|
data/spec/markety/client_spec.rb
CHANGED
@@ -3,8 +3,6 @@ require 'spec_helper'
|
|
3
3
|
module Markety
|
4
4
|
describe Client do
|
5
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
6
|
end
|
9
7
|
end
|
10
8
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
module Command
|
5
|
+
describe GetCustomObject do
|
6
|
+
|
7
|
+
let(:client){ double("client", send_request: nil) }
|
8
|
+
|
9
|
+
describe '#get_custom_object_by_keys' do
|
10
|
+
context "with multiple keys" do
|
11
|
+
it "calls send_request on the client with the correct params" do
|
12
|
+
client.extend(GetCustomObject)
|
13
|
+
client.get_custom_object_by_keys("Roadshow", {"MKTOID" => 1090177, "rid" => 123456})
|
14
|
+
expect(client).to have_received(:send_request).with(:get_custom_objects, {"objTypeName"=>"Roadshow", "customObjKeyList"=>{"attribute"=>[{"attrName" => "MKTOID", "attrValue" => 1090177}, {"attrName" => "rid", "attrValue" => 123456}]}})
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "with a single key" do
|
19
|
+
it "calls send_request on the client with the correct params" do
|
20
|
+
client.extend(GetCustomObject)
|
21
|
+
client.get_custom_object_by_keys("Roadshow", {"MKTOID" => 12341234})
|
22
|
+
expect(client).to have_received(:send_request).with(:get_custom_objects, {"objTypeName"=>"Roadshow", "customObjKeyList"=>{"attribute"=>[{"attrName" => "MKTOID", "attrValue" => 12341234}]}})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
module Command
|
5
|
+
describe SyncCustomObject do
|
6
|
+
|
7
|
+
let(:client){ double("client", send_request: nil) }
|
8
|
+
|
9
|
+
describe '#sync_custom_object' do
|
10
|
+
context "without an operation" do
|
11
|
+
it "calls send_request on the client with the correct params" do
|
12
|
+
custom_object = double(CustomObject, object_type_name: "type", to_sync_custom_object_hash: {"custom_object" => "hash"})
|
13
|
+
client.extend(SyncCustomObject)
|
14
|
+
client.sync_custom_object(custom_object)
|
15
|
+
expect(client).to have_received(:send_request).with(:sync_custom_objects, {"objTypeName" => "type", "operation" => "UPSERT", "customObjList" => {"custom_object" => "hash"}})
|
16
|
+
end
|
17
|
+
end
|
18
|
+
context "without an operation" do
|
19
|
+
it "calls send_request on the client with the correct params" do
|
20
|
+
custom_object = double(CustomObject, object_type_name: "type", to_sync_custom_object_hash: {"custom_object" => "hash"})
|
21
|
+
client.extend(SyncCustomObject)
|
22
|
+
client.sync_custom_object(custom_object, "INSERT")
|
23
|
+
expect(client).to have_received(:send_request).with(:sync_custom_objects, {"objTypeName" => "type", "operation" => "INSERT", "customObjList" => {"custom_object" => "hash"}})
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
describe CustomObject do
|
5
|
+
|
6
|
+
describe '#object_type_name' do
|
7
|
+
it "returns the name of the type of custom object" do
|
8
|
+
custom_object = CustomObject.new(object_type_name: "Roadshow")
|
9
|
+
expect(custom_object.object_type_name).to eq "Roadshow"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#get_key' do
|
14
|
+
it "gets the key" do
|
15
|
+
custom_object = CustomObject.new(object_type_name: "Roadshow", keys: {"MKTOID" => 123})
|
16
|
+
expect(custom_object.get_key("MKTOID")).to eq 123
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#keys' do
|
21
|
+
it "returns all the keys" do
|
22
|
+
custom_object = CustomObject.new(object_type_name: "Roadshow", keys: {"MKTOID" => 123, "rid" => 345})
|
23
|
+
expect(custom_object.keys).to eq({"MKTOID" => 123, "rid" => 345})
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#attributes" do
|
28
|
+
it "returns the attributes" do
|
29
|
+
custom_object = CustomObject.new(attributes: {"someAttribute" => "Value1", "anotherAttribute" => "Coconuts"})
|
30
|
+
expect(custom_object.attributes).to eq({"someAttribute" => "Value1", "anotherAttribute" => "Coconuts"})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#to_sync_custom_object_hash" do
|
35
|
+
it "returns a hash formatted for the sync_custom_object" do
|
36
|
+
custom_object = CustomObject.new(
|
37
|
+
object_type_name: "Roadshow",
|
38
|
+
keys: {"MKTOID" => 123, "rid" => 345},
|
39
|
+
attributes: {"name" => "Some Roadshow", "anotherAttribute" => "Bananas"})
|
40
|
+
|
41
|
+
expect(custom_object.to_sync_custom_object_hash).to eq({
|
42
|
+
"customObj" => {
|
43
|
+
"customObjKeyList" => {
|
44
|
+
"attribute" => [
|
45
|
+
{"attrName" => "MKTOID", "attrValue" => 123},
|
46
|
+
{"attrName" => "rid", "attrValue" => 345}
|
47
|
+
]
|
48
|
+
},
|
49
|
+
"customObjAttributeList" => {
|
50
|
+
"attribute" => [
|
51
|
+
{"attrName" => "name", "attrValue" => "Some Roadshow"},
|
52
|
+
{"attrName" => "anotherAttribute", "attrValue" => "Bananas"},
|
53
|
+
]
|
54
|
+
}
|
55
|
+
}
|
56
|
+
})
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe ".from_marketo_hash" do
|
61
|
+
let(:marketo_hash) {{:custom_obj_key_list=>{:attribute=>[{:attr_name=>"MKTOID", :attr_type=>nil, :attr_value=>"1090177"}, {:attr_name=>"rid", :attr_type=>nil, :attr_value=>"123456"}]}, :custom_obj_attribute_list=>{:attribute=>[{:attr_name=>"city", :attr_type=>nil, :attr_value=>"city4"}, {:attr_name=>"state", :attr_type=>nil, :attr_value=>"state4"}, {:attr_name=>"zip", :attr_type=>nil, :attr_value=>"zip4"}]}}}
|
62
|
+
|
63
|
+
it 'returns a custom object and populates the keys' do
|
64
|
+
custom_object = CustomObject.from_marketo_hash("Roadshow", marketo_hash)
|
65
|
+
expect(custom_object.keys).to eq({"MKTOID" => "1090177", "rid" => "123456"})
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'returns a custom object of the specified type' do
|
69
|
+
custom_object = CustomObject.from_marketo_hash("Roadshow", marketo_hash)
|
70
|
+
expect(custom_object.object_type_name).to eq "Roadshow"
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'returns a custom object and populates the attributes' do
|
74
|
+
custom_object = CustomObject.from_marketo_hash("Roadshow", marketo_hash)
|
75
|
+
expect(custom_object.attributes).to eq({"city" => "city4", "state" => "state4", "zip" => "zip4"})
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
@@ -5,7 +5,7 @@ module Markety
|
|
5
5
|
it "should define the correct types" do
|
6
6
|
LeadKeyType::IDNUM.should == 'IDNUM'
|
7
7
|
LeadKeyType::EMAIL.should == 'EMAIL'
|
8
|
-
|
8
|
+
LeadKeyType::COOKIE.should == 'COOKIE'
|
9
9
|
#LeadKeyType::LEADOWNEREMAIL.should == 'LEADOWNEREMAIL'
|
10
10
|
#LeadKeyType::SFDCACCOUNTID.should == 'SFDCACCOUNTID'
|
11
11
|
#LeadKeyType::SFDCCONTACTID.should == 'SFDCCONTACTID'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
module Response
|
5
|
+
describe GetCustomObjectResponse do
|
6
|
+
|
7
|
+
context "when there is one custom object found" do
|
8
|
+
|
9
|
+
let (:savon_resp) {SavonHelper.create_response(File.read(File.expand_path("../../../fixtures/custom_objects/get_custom_objects/one_custom_object_found.xml", __FILE__)))}
|
10
|
+
|
11
|
+
describe "#success" do
|
12
|
+
it "returns true" do
|
13
|
+
response = GetCustomObjectResponse.new(savon_resp)
|
14
|
+
expect(response.success?).to eq true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#custom_objects" do
|
19
|
+
it "contains one custom object" do
|
20
|
+
response = GetCustomObjectResponse.new(savon_resp)
|
21
|
+
expect(response.custom_objects.size).to eq 1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#custom_object" do
|
26
|
+
it "returns the custom object" do
|
27
|
+
response = GetCustomObjectResponse.new(savon_resp)
|
28
|
+
expect(response.custom_object.object_type_name).to eq "Roadshow"
|
29
|
+
expect(response.custom_object.keys).to eq({"MKTOID" => "1090177", "rid" => "123456"})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
context "when there are multiple custom objects found" do
|
36
|
+
let (:savon_resp) {SavonHelper.create_response(File.read(File.expand_path("../../../fixtures/custom_objects/get_custom_objects/multiple_custom_objects_found.xml", __FILE__)))}
|
37
|
+
|
38
|
+
it "is a successful response" do
|
39
|
+
response = GetCustomObjectResponse.new(savon_resp)
|
40
|
+
expect(response.success?).to eq true
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#custom_objects" do
|
44
|
+
it "contains multiple custom objects" do
|
45
|
+
response = GetCustomObjectResponse.new(savon_resp)
|
46
|
+
expect(response.custom_objects.size).to eq 6
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#custom_object" do
|
51
|
+
it "returns the custom object" do
|
52
|
+
response = GetCustomObjectResponse.new(savon_resp)
|
53
|
+
expect(response.custom_object.object_type_name).to eq "Roadshow"
|
54
|
+
expect(response.custom_object.attributes).to eq({"city" => "city4", "state" => "state4", "zip" => "zip4"})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
context "when there are no custom object found" do
|
61
|
+
let (:savon_resp) {SavonHelper.create_response(File.read(File.expand_path("../../../fixtures/custom_objects/get_custom_objects/no_custom_objects_found.xml", __FILE__)))}
|
62
|
+
let (:response) {GetCustomObjectResponse.new(savon_resp)}
|
63
|
+
|
64
|
+
it "is a successful response" do
|
65
|
+
expect(response.success?).to eq true
|
66
|
+
end
|
67
|
+
|
68
|
+
it "has no custom objects" do
|
69
|
+
expect(response.custom_objects).to be_empty
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Markety
|
4
|
+
module Response
|
5
|
+
describe SyncCustomObjectResponse do
|
6
|
+
let (:successful_response) {SavonHelper.create_response(File.read(File.expand_path("../../../fixtures/custom_objects/sync_custom_objects/successful_sync.xml", __FILE__)))}
|
7
|
+
let (:failed_response) {SavonHelper.create_response(File.read(File.expand_path("../../../fixtures/custom_objects/sync_custom_objects/unknown_attribute.xml", __FILE__)))}
|
8
|
+
|
9
|
+
describe "#success?" do
|
10
|
+
context "with a successful response" do
|
11
|
+
it "returns true" do
|
12
|
+
response = SyncCustomObjectResponse.new(successful_response)
|
13
|
+
expect(response.success?).to eq true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
context "with a failed response" do
|
17
|
+
it "returns false" do
|
18
|
+
response = SyncCustomObjectResponse.new(failed_response)
|
19
|
+
expect(response.success?).to eq false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#error_message" do
|
25
|
+
context "with a successful response" do
|
26
|
+
it "returns nil" do
|
27
|
+
response = SyncCustomObjectResponse.new(successful_response)
|
28
|
+
expect(response.error_message).to be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
context "with a failed response" do
|
32
|
+
it "returns the error" do
|
33
|
+
response = SyncCustomObjectResponse.new(failed_response)
|
34
|
+
expect(response.error_message).to eq "Unknown name attribute list: nameasdf"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#status" do
|
40
|
+
context "with a successful response" do
|
41
|
+
it "returns nil" do
|
42
|
+
response = SyncCustomObjectResponse.new(successful_response)
|
43
|
+
expect(response.status).to eq "UPDATED"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
context "with a failed response" do
|
47
|
+
it "returns the status failed" do
|
48
|
+
response = SyncCustomObjectResponse.new(failed_response)
|
49
|
+
expect(response.status).to eq "FAILED"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#updated_custom_object" do
|
55
|
+
context "with a successful response" do
|
56
|
+
it "returns the custom object" do
|
57
|
+
response = SyncCustomObjectResponse.new(successful_response)
|
58
|
+
expect(response.updated_custom_object.object_type_name).to eq "Roadshow"
|
59
|
+
expect(response.updated_custom_object.keys).to eq({"MKTOID" => "1090177", "rid" => "rid1"})
|
60
|
+
end
|
61
|
+
end
|
62
|
+
context "with a failed response" do
|
63
|
+
it "returns nil" do
|
64
|
+
response = SyncCustomObjectResponse.new(failed_response)
|
65
|
+
expect(response.updated_custom_object).to be_nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markety
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Santoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,34 +72,6 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
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
75
|
- !ruby/object:Gem::Dependency
|
104
76
|
name: pry
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,76 +86,34 @@ dependencies:
|
|
114
86
|
- - ">="
|
115
87
|
- !ruby/object:Gem::Version
|
116
88
|
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
89
|
- !ruby/object:Gem::Dependency
|
160
90
|
name: savon
|
161
91
|
requirement: !ruby/object:Gem::Requirement
|
162
92
|
requirements:
|
163
|
-
- -
|
93
|
+
- - "~>"
|
164
94
|
- !ruby/object:Gem::Version
|
165
|
-
version: 2.3
|
95
|
+
version: '2.3'
|
166
96
|
type: :runtime
|
167
97
|
prerelease: false
|
168
98
|
version_requirements: !ruby/object:Gem::Requirement
|
169
99
|
requirements:
|
170
|
-
- -
|
100
|
+
- - "~>"
|
171
101
|
- !ruby/object:Gem::Version
|
172
|
-
version: 2.3
|
102
|
+
version: '2.3'
|
173
103
|
- !ruby/object:Gem::Dependency
|
174
104
|
name: wasabi
|
175
105
|
requirement: !ruby/object:Gem::Requirement
|
176
106
|
requirements:
|
177
|
-
- -
|
107
|
+
- - "~>"
|
178
108
|
- !ruby/object:Gem::Version
|
179
|
-
version: 3.2
|
109
|
+
version: '3.2'
|
180
110
|
type: :runtime
|
181
111
|
prerelease: false
|
182
112
|
version_requirements: !ruby/object:Gem::Requirement
|
183
113
|
requirements:
|
184
|
-
- -
|
114
|
+
- - "~>"
|
185
115
|
- !ruby/object:Gem::Version
|
186
|
-
version: 3.2
|
116
|
+
version: '3.2'
|
187
117
|
description: A client to allow easy integration with Marketo's SOAP API
|
188
118
|
email:
|
189
119
|
- david.e.santoso@gmail.com
|
@@ -214,26 +144,42 @@ files:
|
|
214
144
|
- lib/markety/authentication_header.rb
|
215
145
|
- lib/markety/client.rb
|
216
146
|
- lib/markety/command.rb
|
147
|
+
- lib/markety/command/get_custom_object.rb
|
217
148
|
- lib/markety/command/get_lead.rb
|
218
149
|
- lib/markety/command/list_operation.rb
|
150
|
+
- lib/markety/command/sync_custom_object.rb
|
219
151
|
- lib/markety/command/sync_lead.rb
|
152
|
+
- lib/markety/custom_object.rb
|
220
153
|
- lib/markety/enums.rb
|
221
154
|
- lib/markety/lead.rb
|
222
155
|
- lib/markety/lead_key.rb
|
223
156
|
- lib/markety/response.rb
|
224
157
|
- lib/markety/response/generic_response.rb
|
158
|
+
- lib/markety/response/get_custom_object_response.rb
|
225
159
|
- lib/markety/response/get_lead_response.rb
|
226
160
|
- lib/markety/response/list_operation_response.rb
|
227
161
|
- lib/markety/response/response_factory.rb
|
162
|
+
- lib/markety/response/sync_custom_object_response.rb
|
228
163
|
- lib/markety/response/sync_lead_response.rb
|
229
164
|
- lib/markety/version.rb
|
230
165
|
- markety.gemspec
|
166
|
+
- spec/fixtures/custom_objects/get_custom_objects/multiple_custom_objects_found.xml
|
167
|
+
- spec/fixtures/custom_objects/get_custom_objects/no_custom_objects_found.xml
|
168
|
+
- spec/fixtures/custom_objects/get_custom_objects/one_custom_object_found.xml
|
169
|
+
- spec/fixtures/custom_objects/sync_custom_objects/invalid_object_name.xml
|
170
|
+
- spec/fixtures/custom_objects/sync_custom_objects/successful_sync.xml
|
171
|
+
- spec/fixtures/custom_objects/sync_custom_objects/unknown_attribute.xml
|
231
172
|
- spec/markety/authentication_header_spec.rb
|
232
173
|
- spec/markety/client_spec.rb
|
174
|
+
- spec/markety/command/get_custom_object_spec.rb
|
175
|
+
- spec/markety/command/sync_custom_object_spec.rb
|
176
|
+
- spec/markety/custom_object_spec.rb
|
233
177
|
- spec/markety/lead_key_spec.rb
|
234
178
|
- spec/markety/lead_spec.rb
|
179
|
+
- spec/markety/response/get_custom_object_response_spec.rb
|
235
180
|
- spec/markety/response/get_lead_response_spec.rb
|
236
181
|
- spec/markety/response/list_operation_response_spec.rb
|
182
|
+
- spec/markety/response/sync_custom_object_response_spec.rb
|
237
183
|
- spec/markety/response/sync_lead_response_spec.rb
|
238
184
|
- spec/spec_helper.rb
|
239
185
|
- spec/support/savon_helper.rb
|
@@ -249,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
249
195
|
requirements:
|
250
196
|
- - ">="
|
251
197
|
- !ruby/object:Gem::Version
|
252
|
-
version:
|
198
|
+
version: 2.0.0
|
253
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
200
|
requirements:
|
255
201
|
- - ">="
|
@@ -257,17 +203,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
203
|
version: '0'
|
258
204
|
requirements: []
|
259
205
|
rubyforge_project:
|
260
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.4.5
|
261
207
|
signing_key:
|
262
208
|
specification_version: 4
|
263
209
|
summary: Marketo SOAP API integration
|
264
210
|
test_files:
|
211
|
+
- spec/fixtures/custom_objects/get_custom_objects/multiple_custom_objects_found.xml
|
212
|
+
- spec/fixtures/custom_objects/get_custom_objects/no_custom_objects_found.xml
|
213
|
+
- spec/fixtures/custom_objects/get_custom_objects/one_custom_object_found.xml
|
214
|
+
- spec/fixtures/custom_objects/sync_custom_objects/invalid_object_name.xml
|
215
|
+
- spec/fixtures/custom_objects/sync_custom_objects/successful_sync.xml
|
216
|
+
- spec/fixtures/custom_objects/sync_custom_objects/unknown_attribute.xml
|
265
217
|
- spec/markety/authentication_header_spec.rb
|
266
218
|
- spec/markety/client_spec.rb
|
219
|
+
- spec/markety/command/get_custom_object_spec.rb
|
220
|
+
- spec/markety/command/sync_custom_object_spec.rb
|
221
|
+
- spec/markety/custom_object_spec.rb
|
267
222
|
- spec/markety/lead_key_spec.rb
|
268
223
|
- spec/markety/lead_spec.rb
|
224
|
+
- spec/markety/response/get_custom_object_response_spec.rb
|
269
225
|
- spec/markety/response/get_lead_response_spec.rb
|
270
226
|
- spec/markety/response/list_operation_response_spec.rb
|
227
|
+
- spec/markety/response/sync_custom_object_response_spec.rb
|
271
228
|
- spec/markety/response/sync_lead_response_spec.rb
|
272
229
|
- spec/spec_helper.rb
|
273
230
|
- spec/support/savon_helper.rb
|