marketo_api 0.0.7.pre.alpha → 0.1.1.pre.alpha
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 +5 -5
- data/.github/PULL_REQUEST_TEMPLATE.md +15 -0
- data/.travis.yml +0 -3
- data/History.md +5 -0
- data/lib/marketo_api.rb +1 -0
- data/lib/marketo_api/abstract_client.rb +1 -0
- data/lib/marketo_api/api/activities.rb +0 -5
- data/lib/marketo_api/api/base.rb +32 -0
- data/lib/marketo_api/api/campaigns.rb +60 -5
- data/lib/marketo_api/api/workspaces.rb +25 -0
- data/lib/marketo_api/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b66ff88fcb787f69745f1119bfa69298cca89aec9e3446a12cc5688e3b4cf2f5
|
4
|
+
data.tar.gz: 7bbbed4b3ba4c557dd54f3ad212f8029fcbbd953d5537ab7e16c39c58ea46a71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9db3ec1fe011c9e759ed589e2ca17baac5bd5f35ab56f096e2c9ab8c232b225b80d55cdf97755372607cc9905008a45c0d38c1b3991cd76925d7df1aa267c92
|
7
|
+
data.tar.gz: 39b6e083bf6123d7021e7186df8eb651d07516022eb3e81c4e4f5d54a4dac94d6181123473ab63dec28aead571dd7c74d8b049e702edd61e01d79d69579aae10
|
data/.travis.yml
CHANGED
data/History.md
ADDED
data/lib/marketo_api.rb
CHANGED
@@ -25,6 +25,7 @@ module MarketoApi
|
|
25
25
|
autoload :Stats, 'marketo_api/api/stats'
|
26
26
|
autoload :Activities, 'marketo_api/api/activities'
|
27
27
|
autoload :Campaigns, 'marketo_api/api/campaigns'
|
28
|
+
autoload :Workspaces, 'marketo_api/api/workspaces'
|
28
29
|
end
|
29
30
|
|
30
31
|
Error = Class.new(StandardError)
|
@@ -28,11 +28,6 @@ module MarketoApi
|
|
28
28
|
api_get("activities/pagingtoken.json?sinceDatetime=#{mod_time}")
|
29
29
|
end
|
30
30
|
|
31
|
-
def add_next_page_token(path, token)
|
32
|
-
path = "#{path}&nextPageToken=#{token}" if token
|
33
|
-
path
|
34
|
-
end
|
35
|
-
|
36
31
|
def add_activity_type_ids(type_ids)
|
37
32
|
ids = format_filter_values(type_ids)
|
38
33
|
if ids
|
data/lib/marketo_api/api/base.rb
CHANGED
@@ -46,6 +46,38 @@ module MarketoApi
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# Internal: Converts a hash into a string that can be consumed by
|
50
|
+
# the Marketo API as a query string
|
51
|
+
#
|
52
|
+
# Examples
|
53
|
+
#
|
54
|
+
# to_query({ source: 'Sales Engage', workspaceName: 'Global' })
|
55
|
+
# # => 'source=Sales%20Engage&workspaceName=Global'
|
56
|
+
def to_query(options = {})
|
57
|
+
options.to_query.gsub('+', '%20')
|
58
|
+
end
|
59
|
+
|
60
|
+
# Internal: Append a nextPageToken to a url if token is present
|
61
|
+
#
|
62
|
+
# Examples
|
63
|
+
#
|
64
|
+
# add_next_page_token('activities.json?')
|
65
|
+
# # => '/rest/v1/leads'
|
66
|
+
def add_next_page_token(path, token)
|
67
|
+
path += "&nextPageToken=#{token}" if token
|
68
|
+
path
|
69
|
+
end
|
70
|
+
|
71
|
+
# Internal: Returns hash for next page token param
|
72
|
+
#
|
73
|
+
# Examples
|
74
|
+
#
|
75
|
+
# add_next_page_token('123')
|
76
|
+
# # => { nextPageToken: '123' }
|
77
|
+
def paging_token_param(token)
|
78
|
+
token.present? ? { nextPageToken: token } : {}
|
79
|
+
end
|
80
|
+
|
49
81
|
def extract_case_insensitive_string_or_symbol_key_from_hash!(hash, key)
|
50
82
|
value = hash.delete(key.to_sym)
|
51
83
|
value ||= hash.delete(key.to_s)
|
@@ -34,7 +34,7 @@ module MarketoApi
|
|
34
34
|
#
|
35
35
|
# Example
|
36
36
|
# # Find the specific campaign
|
37
|
-
# client.campaigns_by_workspace(
|
37
|
+
# client.campaigns_by_workspace('Default')
|
38
38
|
# # => {
|
39
39
|
# "requestId": "cab#15f4b36d1ca"
|
40
40
|
# "success": "true"
|
@@ -60,10 +60,65 @@ module MarketoApi
|
|
60
60
|
# "success": true
|
61
61
|
# }
|
62
62
|
#
|
63
|
-
def campaigns_by_workspace(
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
def campaigns_by_workspace(workspace_name = 'Default', options = {})
|
64
|
+
options[:workspaceName] = workspace_name
|
65
|
+
campaigns(options)
|
66
|
+
end
|
67
|
+
|
68
|
+
def campaigns_next_page(next_page_token, options = {})
|
69
|
+
campaigns(options.merge(paging_token_param(next_page_token)))
|
70
|
+
end
|
71
|
+
|
72
|
+
def campaigns(options = {})
|
73
|
+
options_query = to_query(options)
|
74
|
+
api_get("campaigns.json?#{options_query}")
|
75
|
+
end
|
76
|
+
|
77
|
+
# Public: Passes a set of leads to a trigger campaign to run through the campaign's flow.
|
78
|
+
# The designated campaign must have a Campaign is Requested: Web Service API trigger, and
|
79
|
+
# must be active. My tokens local to the campaign's parent program can be overridden for
|
80
|
+
# the run to customize content.
|
81
|
+
#
|
82
|
+
# Required Permissions: Execute Campaign
|
83
|
+
#
|
84
|
+
#
|
85
|
+
# Example
|
86
|
+
# # Add lead to trigger campaign
|
87
|
+
# client.trigger_campaign!(3711, {})
|
88
|
+
# # => {
|
89
|
+
# "errors": [
|
90
|
+
# {
|
91
|
+
# "code": 0,
|
92
|
+
# "message": "string"
|
93
|
+
# }
|
94
|
+
# ],
|
95
|
+
# "moreResult": false,
|
96
|
+
# "nextPageToken": "string",
|
97
|
+
# "requestId": "string",
|
98
|
+
# "result": [
|
99
|
+
# {
|
100
|
+
# "active": false,
|
101
|
+
# "createdAt": "string",
|
102
|
+
# "description": "string",
|
103
|
+
# "id": 0,
|
104
|
+
# "name": "string",
|
105
|
+
# "programId": 0,
|
106
|
+
# "programName": "string",
|
107
|
+
# "type": "batch",
|
108
|
+
# "updatedAt": "string",
|
109
|
+
# "workspaceName": "string"
|
110
|
+
# }
|
111
|
+
# ],
|
112
|
+
# "success": false,
|
113
|
+
# "warnings": [
|
114
|
+
# {
|
115
|
+
# "code": 0,
|
116
|
+
# "message": "string"
|
117
|
+
# }
|
118
|
+
# ]
|
119
|
+
# }
|
120
|
+
def trigger_campaign!(campaign_id, attrs)
|
121
|
+
api_post("campaigns/#{campaign_id}/trigger.json", attrs)
|
67
122
|
end
|
68
123
|
end
|
69
124
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module MarketoApi
|
2
|
+
module API
|
3
|
+
module Workspaces
|
4
|
+
include Base
|
5
|
+
|
6
|
+
# Public: Returns an array of workspaces for the current user.
|
7
|
+
# Example
|
8
|
+
# client.user_workspaces
|
9
|
+
# => [{
|
10
|
+
# "id": 102,
|
11
|
+
# "name": "A cool Marketo workspace",
|
12
|
+
# "description": "This workspace is amazing!",
|
13
|
+
# "globalViz": 0,
|
14
|
+
# "status": "active",
|
15
|
+
# "currencyInfo": nil,
|
16
|
+
# "createdAt": "20180112T18:07:09.0t+0000",
|
17
|
+
# "updatedAt": "20180112T18:07:09.0t+0000"
|
18
|
+
# }]
|
19
|
+
|
20
|
+
def user_workspaces
|
21
|
+
get("userservice/lm/v1/workspaces/")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/marketo_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marketo_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ami Bhatt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday_middleware
|
@@ -201,6 +201,7 @@ extensions: []
|
|
201
201
|
extra_rdoc_files: []
|
202
202
|
files:
|
203
203
|
- ".codeclimate.yml"
|
204
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
204
205
|
- ".gitignore"
|
205
206
|
- ".rubocop.yml"
|
206
207
|
- ".travis.yml"
|
@@ -208,6 +209,7 @@ files:
|
|
208
209
|
- Gemfile
|
209
210
|
- Gemfile.lock
|
210
211
|
- Guardfile
|
212
|
+
- History.md
|
211
213
|
- LICENSE
|
212
214
|
- README.md
|
213
215
|
- Rakefile
|
@@ -226,6 +228,7 @@ files:
|
|
226
228
|
- lib/marketo_api/api/leads.rb
|
227
229
|
- lib/marketo_api/api/sales.rb
|
228
230
|
- lib/marketo_api/api/stats.rb
|
231
|
+
- lib/marketo_api/api/workspaces.rb
|
229
232
|
- lib/marketo_api/client.rb
|
230
233
|
- lib/marketo_api/concerns/authentication.rb
|
231
234
|
- lib/marketo_api/concerns/base.rb
|
@@ -262,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
265
|
version: 1.3.1
|
263
266
|
requirements: []
|
264
267
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.
|
268
|
+
rubygems_version: 2.7.3
|
266
269
|
signing_key:
|
267
270
|
specification_version: 4
|
268
271
|
summary: Marketo REST API ruby gem
|