mrkt 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19c375fe88c8b99a1d7af83714409133424c3e7c
4
- data.tar.gz: 88ebcda5a1b3dad3aaaf593552961d78a0e45512
3
+ metadata.gz: 7d3728f0e153f6f7f2cc24bdad8e72a88c71604f
4
+ data.tar.gz: d5b9cb48773b20627eae5ab686fa2306cb6df88f
5
5
  SHA512:
6
- metadata.gz: a5ca3432d050e8caf2d44edb44fcef9ef4f7840ee66dd7516ec8c38bf11e1c52e31151ee2b9d299bb210ae047a95add038f06c18e997104c74b96c81dc69b898
7
- data.tar.gz: e44bd10fec6bc3477fcaf42e2939c78cdd7efa6fa1f348d39561022856eb7d01d5487f440e19bdfaafe68dacb2c9bb2892b1a61b63c0ede684750c39747935d7
6
+ metadata.gz: 0c493d4c6d76bd816db9ae3b550ed15910a6c8e70c6baf4e10cb10a218d3cccad98f3a5a807c32fa7defd7694bba54cfbf7b8e4d401ccda8c82c040f696a3a71
7
+ data.tar.gz: 061a382925a6618d1616238ece57e074ace34096832b9c93b69eb62552d228f5d0156fc715c1c7cd5805d6877c5c08ba97b676a2a359147d1f5f56e128cc159b
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mrkt (0.6.2)
4
+ mrkt (0.7.0)
5
+ faraday (> 0.9.0, < 0.11.0)
5
6
  faraday_middleware (> 0.9.0, < 0.11.0)
6
7
 
7
8
  GEM
@@ -25,7 +26,7 @@ GEM
25
26
  multipart-post (>= 1.2, < 3)
26
27
  faraday_middleware (0.10.0)
27
28
  faraday (>= 0.7.4, < 0.10)
28
- json (1.8.2)
29
+ json (1.8.3)
29
30
  method_source (0.8.2)
30
31
  multipart-post (2.0.0)
31
32
  parser (2.2.2.6)
@@ -39,7 +40,7 @@ GEM
39
40
  byebug (~> 4.0)
40
41
  pry (~> 0.10)
41
42
  rainbow (2.0.0)
42
- rake (10.1.1)
43
+ rake (10.5.0)
43
44
  rspec (3.2.0)
44
45
  rspec-core (~> 3.2.0)
45
46
  rspec-expectations (~> 3.2.0)
@@ -86,4 +87,4 @@ DEPENDENCIES
86
87
  webmock (~> 1.21.0)
87
88
 
88
89
  BUNDLED WITH
89
- 1.11.2
90
+ 1.13.1
data/README.md CHANGED
@@ -44,12 +44,35 @@ client = Mrkt::Client.new(
44
44
  client_secret: '7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt')
45
45
  ```
46
46
 
47
- If you need verbosity during troubleshooting, set the client to debug mode
47
+ If you need verbosity during troubleshooting, enable debug mode:
48
48
 
49
49
  ```ruby
50
- client.debug = true
50
+ client = Mrkt::Client.new(
51
+ host: '123-abc-123.mktorest.com',
52
+ client_id: '4567e1cdf-0fae-4685-a914-5be45043f2d8',
53
+ client_secret: '7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt',
54
+ debug: true,
55
+ logger: ::Logger.new("log/marketo.log"), # optional, defaults to Faraday default of logging to STDOUT
56
+ log_options: {bodies: true}) # optional, defaults to Faraday default of only logging headers
57
+ ```
58
+
59
+ ### Retry authentication
60
+
61
+ Since the Marketo API provides API access keys with a validity of 3600 seconds, if you are running an hourly cronjob it's possible that your subsequent call receives the same key from the previous hour, which is then immediately expired. If this is the case, you can configure the client to retry until receiving a valid key:
62
+
63
+ ```ruby
64
+ client = Mrkt::Client.new(
65
+ host: '123-abc-123.mktorest.com',
66
+ client_id: '4567e1cdf-0fae-4685-a914-5be45043f2d8',
67
+ client_secret: '7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt',
68
+ retry_authentication: true,
69
+ retry_authentication_count: 3, # default: 3
70
+ retry_authentication_wait_seconds: 1, # default: 0
71
+ )
51
72
  ```
52
73
 
74
+ This is turned off by default.
75
+
53
76
  ### Get leads matching an email, print their id and email
54
77
 
55
78
  ```ruby
@@ -9,6 +9,7 @@ require 'mrkt/concerns/crud_leads'
9
9
  require 'mrkt/concerns/crud_lists'
10
10
  require 'mrkt/concerns/import_leads'
11
11
  require 'mrkt/concerns/crud_custom_objects'
12
+ require 'mrkt/concerns/crud_custom_activities'
12
13
  require 'mrkt/concerns/crud_programs'
13
14
 
14
15
  module Mrkt
@@ -21,6 +22,7 @@ module Mrkt
21
22
  include CrudLists
22
23
  include ImportLeads
23
24
  include CrudCustomObjects
25
+ include CrudCustomActivities
24
26
  include CrudPrograms
25
27
 
26
28
  attr_accessor :debug
@@ -31,6 +33,15 @@ module Mrkt
31
33
  @client_id = options.fetch(:client_id)
32
34
  @client_secret = options.fetch(:client_secret)
33
35
 
36
+ @retry_authentication = options.fetch(:retry_authentication, false)
37
+ @retry_authentication_count = options.fetch(:retry_authentication_count, 3).to_i
38
+ @retry_authentication_wait_seconds = options.fetch(:retry_authentication_wait_seconds, 0).to_i
39
+
40
+ @debug = options[:debug]
41
+
42
+ @logger = options[:logger]
43
+ @log_options = options[:log_options]
44
+
34
45
  @options = options
35
46
  end
36
47
 
@@ -1,7 +1,18 @@
1
1
  module Mrkt
2
2
  module Authentication
3
3
  def authenticate!
4
- authenticate unless authenticated?
4
+ return if authenticated?
5
+
6
+ authenticate
7
+
8
+ if !authenticated? && @retry_authentication
9
+ @retry_authentication_count.times do
10
+ sleep(@retry_authentication_wait_seconds) if @retry_authentication_wait_seconds > 0
11
+ authenticate
12
+ break if authenticated?
13
+ end
14
+ end
15
+
5
16
  fail Mrkt::Errors::AuthorizationError, 'Client not authenticated' unless authenticated?
6
17
  end
7
18
 
@@ -11,7 +11,10 @@ module Mrkt
11
11
  conn.request :multipart
12
12
  conn.request :url_encoded
13
13
 
14
- conn.response :logger if @debug
14
+ if @debug
15
+ conn.response :logger, @logger, (@log_options || {})
16
+ end
17
+
15
18
  conn.response :mkto, content_type: /\bjson$/
16
19
 
17
20
  conn.options.timeout = @options[:read_timeout] if @options.key?(:read_timeout)
@@ -0,0 +1,34 @@
1
+ require 'time'
2
+
3
+ module Mrkt
4
+ module CrudCustomActivities
5
+ def get_list_of_custom_activity_types
6
+ get('/rest/v1/activities/types.json')
7
+ end
8
+
9
+ def create_custom_activity(lead_id, activity_type_id, primary_attribute_value, attributes: {}, date: nil)
10
+ date ||= Time.now
11
+ date = date.utc.iso8601
12
+ converted_attributes = convert_attribute_hash(attributes)
13
+
14
+ input = [{
15
+ leadId: lead_id,
16
+ activityDate: date,
17
+ activityTypeId: activity_type_id,
18
+ primaryAttributeValue: primary_attribute_value,
19
+ attributes: converted_attributes
20
+ }]
21
+ post('/rest/v1/activities/external.json') do |req|
22
+ json_payload(req, input: input)
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def convert_attribute_hash(attributes)
29
+ attributes.map do |key, value|
30
+ { name: key, value: value }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,6 +1,6 @@
1
1
  module Mrkt
2
2
  module CrudCustomObjects
3
- def get_list_of_custom_objects(names=nil)
3
+ def get_list_of_custom_objects(names = nil)
4
4
  params = {}
5
5
  params[:names] = names.join(',') if names
6
6
 
@@ -1,3 +1,3 @@
1
1
  module Mrkt
2
- VERSION = '0.6.2'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '~> 2.0'
22
22
 
23
+ spec.add_dependency 'faraday', '> 0.9.0', '< 0.11.0'
23
24
  spec.add_dependency 'faraday_middleware', '> 0.9.0', '< 0.11.0'
24
25
 
25
26
  spec.add_development_dependency 'bundler', '~> 1.3'
@@ -22,6 +22,49 @@ describe Mrkt::Authentication do
22
22
  end
23
23
  end
24
24
 
25
+ describe '#authenticate!' do
26
+ it 'should authenticate and then be authenticated?' do
27
+ expect(client.authenticated?).to_not be true
28
+ client.authenticate!
29
+ expect(client.authenticated?).to be true
30
+ end
31
+
32
+ context 'when the token has expired and @retry_authentication = true' do
33
+ before { remove_request_stub(@authentication_request_stub) }
34
+
35
+ let(:expired_authentication_stub) do
36
+ { access_token: SecureRandom.uuid, token_type: 'bearer', expires_in: 0, scope: 'RestClient' }
37
+ end
38
+
39
+ let(:valid_authentication_stub) do
40
+ { access_token: SecureRandom.uuid, token_type: 'bearer', expires_in: 1234, scope: 'RestClient' }
41
+ end
42
+
43
+ subject(:client) { Mrkt::Client.new(host: host, client_id: client_id, client_secret: client_secret, retry_authentication: true) }
44
+
45
+ before do
46
+ stub_request(:get, "https://#{host}/identity/oauth/token")
47
+ .with(query: { client_id: client_id, client_secret: client_secret, grant_type: 'client_credentials' })
48
+ .to_return(json_stub(expired_authentication_stub)).times(3).then
49
+ .to_return(json_stub(valid_authentication_stub))
50
+ end
51
+
52
+ it 'should retry until getting valid token and then be authenticated?' do
53
+ expect(client.authenticated?).to_not be true
54
+ client.authenticate!
55
+ expect(client.authenticated?).to be true
56
+ end
57
+
58
+ it 'should stop retrying after @retry_authentication_count tries and then raise an error' do
59
+ client = Mrkt::Client.new(host: host, client_id: client_id, client_secret: client_secret, retry_authentication: true, retry_authentication_count: 2)
60
+
61
+ expect(client.authenticated?).to_not be true
62
+
63
+ expect { client.authenticate! }.to raise_error(Mrkt::Errors::Error, 'Client not authenticated')
64
+ end
65
+ end
66
+ end
67
+
25
68
  describe '#authenticated?' do
26
69
  subject { client.authenticated? }
27
70
 
@@ -0,0 +1,170 @@
1
+ describe Mrkt::CrudCustomObjects do
2
+ include_context 'initialized client'
3
+
4
+ describe '#get_list_of_custom_activity_types' do
5
+ let(:response_stub) do
6
+ {
7
+ requestId: '14ff3#1579a716c12',
8
+ result: [
9
+ {
10
+ id: 1,
11
+ name: 'Visit Webpage',
12
+ description: 'User visits a web page',
13
+ primaryAttribute: {
14
+ name: 'Webpage ID',
15
+ dataType: 'integer'
16
+ },
17
+ attributes: [
18
+ {
19
+ name: 'Client IP Address',
20
+ dataType: 'string'
21
+ },
22
+ {
23
+ name: 'Query Parameters',
24
+ dataType: 'string'
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ id: 1,
30
+ name: 'Visit Webpage',
31
+ description: 'User visits a web page',
32
+ primaryAttribute: {
33
+ name: 'Webpage ID',
34
+ dataType: 'integer'
35
+ },
36
+ attributes: [
37
+ {
38
+ name: 'Client IP Address',
39
+ dataType: 'string'
40
+ },
41
+ {
42
+ name: 'Query Parameters',
43
+ dataType: 'string'
44
+ }
45
+ ]
46
+ }
47
+ ],
48
+ success: true
49
+ }
50
+ end
51
+
52
+ context 'all activities' do
53
+ before do
54
+ stub_request(:get, "https://#{host}/rest/v1/activities/types.json")
55
+ .to_return(json_stub(response_stub))
56
+ end
57
+
58
+ subject { client.get_list_of_custom_activity_types }
59
+
60
+ it { is_expected.to eq(response_stub) }
61
+ end
62
+ end
63
+
64
+ describe '#create_custom_activity' do
65
+ let(:response_stub) do
66
+ {
67
+ requestId: 'c245#14cd6830ae2',
68
+ result: [
69
+ {
70
+ activityDate: 'string',
71
+ activityTypeId: 0,
72
+ apiName: 'string',
73
+ attributes: [
74
+ {
75
+ apiName: 'string',
76
+ name: 'string',
77
+ value: {}
78
+ }
79
+ ],
80
+ id: 0,
81
+ leadId: 0,
82
+ primaryAttributeValue: 'string',
83
+ status: 'created'
84
+ }
85
+ ],
86
+ success: true
87
+ }
88
+ end
89
+
90
+ let(:lead_id) do
91
+ 1
92
+ end
93
+
94
+ let(:activity_type_id) do
95
+ 100_000
96
+ end
97
+
98
+ let(:primary_attribute_value) do
99
+ 'Friday'
100
+ end
101
+
102
+ let(:date) do
103
+ Time.now
104
+ end
105
+
106
+ context 'with no additional attributes' do
107
+ let(:request_body) do
108
+ {
109
+ input: [{
110
+ leadId: lead_id,
111
+ activityDate: date.utc.iso8601,
112
+ activityTypeId: activity_type_id,
113
+ primaryAttributeValue: primary_attribute_value,
114
+ attributes: []
115
+ }]
116
+ }
117
+ end
118
+
119
+ before do
120
+ stub_request(:post, "https://#{host}/rest/v1/activities/external.json")
121
+ .with(json_stub(request_body))
122
+ .to_return(json_stub(response_stub))
123
+ end
124
+
125
+ subject { client.create_custom_activity(lead_id, activity_type_id, primary_attribute_value, date: date) }
126
+
127
+ it { is_expected.to eq(response_stub) }
128
+ end
129
+
130
+ context 'with additional attributes' do
131
+ let(:request_body) do
132
+ {
133
+ input: [{
134
+ leadId: lead_id,
135
+ activityDate: date.utc.iso8601,
136
+ activityTypeId: activity_type_id,
137
+ primaryAttributeValue: primary_attribute_value,
138
+ attributes: [
139
+ {
140
+ name: 'percent',
141
+ value: '0.20'
142
+ },
143
+ {
144
+ name: 'resourceId',
145
+ value: '_Hy8Sfk9938005SSF'
146
+ }
147
+ ]
148
+ }]
149
+ }
150
+ end
151
+
152
+ before do
153
+ stub_request(:post, "https://#{host}/rest/v1/activities/external.json")
154
+ .with(json_stub(request_body))
155
+ .to_return(json_stub(response_stub))
156
+ end
157
+
158
+ let(:attributes) do
159
+ {
160
+ percent: '0.20',
161
+ resourceId: '_Hy8Sfk9938005SSF'
162
+ }
163
+ end
164
+
165
+ subject { client.create_custom_activity(lead_id, activity_type_id, primary_attribute_value, attributes: attributes, date: date) }
166
+
167
+ it { is_expected.to eq(response_stub) }
168
+ end
169
+ end
170
+ end
@@ -5,35 +5,40 @@ describe Mrkt::CrudCustomObjects do
5
5
  let(:response_stub) do
6
6
  {
7
7
  requestId: 'c245#14cd6830ae2',
8
- result: [{
9
- name: 'device_c',
10
- displayName: 'Device',
11
- description: 'this is a device object',
12
- createdAt: '2016-01-23T00:51:18Z',
13
- updatedAt: '2016-01-23T00:51:18Z',
14
- idField: 'marketoGUID',
15
- dedupeFields: ['serialNumber'],
16
- searchableFields: [['serialNumber'], ['marketoGUID']],
17
- relationships: [{
18
- field: 'email',
19
- type: 'child',
20
- relatedTo: { name: 'Lead', field: 'email' }
21
- }],
22
- },
23
- {
24
- name: 'manufacturer_c',
25
- displayName: 'Manufacturer',
26
- createdAt: '2016-01-23T00:55:18Z',
27
- updatedAt: '2016-01-23T00:55:18Z',
28
- idField: 'marketoGUID',
29
- dedupeFields: ['name'],
30
- searchableFields: [['name'], ['marketoGUID']],
31
- relationships: [{
32
- field: 'email',
33
- type: 'child',
34
- relatedTo: { name: 'Lead', field: 'email' }
35
- }]
36
- }],
8
+ result: [
9
+ {
10
+ name: 'device_c',
11
+ displayName: 'Device',
12
+ description: 'this is a device object',
13
+ createdAt: '2016-01-23T00:51:18Z',
14
+ updatedAt: '2016-01-23T00:51:18Z',
15
+ idField: 'marketoGUID',
16
+ dedupeFields: ['serialNumber'],
17
+ searchableFields: [['serialNumber'], ['marketoGUID']],
18
+ relationships: [
19
+ {
20
+ field: 'email',
21
+ type: 'child',
22
+ relatedTo: { name: 'Lead', field: 'email' }
23
+ }
24
+ ]
25
+ }, {
26
+ name: 'manufacturer_c',
27
+ displayName: 'Manufacturer',
28
+ createdAt: '2016-01-23T00:55:18Z',
29
+ updatedAt: '2016-01-23T00:55:18Z',
30
+ idField: 'marketoGUID',
31
+ dedupeFields: ['name'],
32
+ searchableFields: [['name'], ['marketoGUID']],
33
+ relationships: [
34
+ {
35
+ field: 'email',
36
+ type: 'child',
37
+ relatedTo: { name: 'Lead', field: 'email' }
38
+ }
39
+ ]
40
+ }
41
+ ],
37
42
  success: true
38
43
  }
39
44
  end
@@ -54,7 +59,7 @@ describe Mrkt::CrudCustomObjects do
54
59
 
55
60
  before do
56
61
  stub_request(:get, "https://#{host}/rest/v1/customobjects.json")
57
- .with(query: {names: object_names.join(',')})
62
+ .with(query: { names: object_names.join(',') })
58
63
  .to_return(json_stub(response_stub))
59
64
  end
60
65
 
@@ -67,50 +72,56 @@ describe Mrkt::CrudCustomObjects do
67
72
  describe '#describe_custom_object' do
68
73
  let(:response_stub) do
69
74
  {
70
- requestId: "eeef#152858b17d2",
71
- result: [{
72
- name: "device_c",
73
- displayName: "Device",
74
- description: "this is a device object",
75
- createdAt: "2016-01-23T00:51:18Z",
76
- updatedAt: "2016-01-23T00:51:18Z",
77
- idField: "marketoGUID",
78
- dedupeFields: ["serialNumber"],
79
- searchableFields: [["serialNumber"], ["marketoGUID"]],
80
- relationships: [{
81
- field: "serialNumber",
82
- type: "child",
83
- relatedTo: {
84
- name: "Lead",
85
- field: "serialNumber"
86
- }
87
- }],
88
- fields: [{
89
- name: "createdAt",
90
- displayName: "Created At",
91
- dataType: "datetime",
92
- updateable: false
93
- },
94
- { name: "marketoGUID",
95
- displayName: "Marketo GUID",
96
- dataType: "string",
97
- length:36,
98
- updateable: false
99
- },
100
- { name: "updatedAt",
101
- displayName: "Updated At",
102
- dataType: "datetime",
103
- updateable: false
104
- },
105
- { name: "serialNumber",
106
- displayName: "serial number",
107
- dataType: "string",
108
- length: 255,
109
- updateable: true
110
- }]
111
- }],
112
- success: true
113
- }
75
+ requestId: 'eeef#152858b17d2',
76
+ result: [
77
+ {
78
+ name: 'device_c',
79
+ displayName: 'Device',
80
+ description: 'this is a device object',
81
+ createdAt: '2016-01-23T00:51:18Z',
82
+ updatedAt: '2016-01-23T00:51:18Z',
83
+ idField: 'marketoGUID',
84
+ dedupeFields: ['serialNumber'],
85
+ searchableFields: [['serialNumber'], ['marketoGUID']],
86
+ relationships: [
87
+ {
88
+ field: 'serialNumber',
89
+ type: 'child',
90
+ relatedTo: {
91
+ name: 'Lead',
92
+ field: 'serialNumber'
93
+ }
94
+ }
95
+ ],
96
+ fields: [
97
+ {
98
+ name: 'createdAt',
99
+ displayName: 'Created At',
100
+ dataType: 'datetime',
101
+ updateable: false
102
+ }, {
103
+ name: 'marketoGUID',
104
+ displayName: 'Marketo GUID',
105
+ dataType: 'string',
106
+ length: 36,
107
+ updateable: false
108
+ }, {
109
+ name: 'updatedAt',
110
+ displayName: 'Updated At',
111
+ dataType: 'datetime',
112
+ updateable: false
113
+ }, {
114
+ name: 'serialNumber',
115
+ displayName: 'serial number',
116
+ dataType: 'string',
117
+ length: 255,
118
+ updateable: true
119
+ }
120
+ ]
121
+ }
122
+ ],
123
+ success: true
124
+ }
114
125
  end
115
126
 
116
127
  before do
@@ -120,23 +131,22 @@ describe Mrkt::CrudCustomObjects do
120
131
 
121
132
  subject { client.describe_custom_object(object_name) }
122
133
 
123
- context "when the object name is valid" do
134
+ context 'when the object name is valid' do
124
135
  let(:object_name) { :device_c }
125
136
 
126
137
  it { is_expected.to eq(response_stub) }
127
138
  end
128
139
 
129
- context "when the object name is invalid" do
140
+ context 'when the object name is invalid' do
130
141
  let(:object_name) { nil }
131
142
 
132
143
  it 'should raise an Error' do
133
- object_name = []
134
144
  expect { subject }.to raise_error(Mrkt::Errors::Unknown)
135
145
  end
136
146
  end
137
147
  end
138
148
 
139
- describe "#createupdate_custom_objects" do
149
+ describe '#createupdate_custom_objects' do
140
150
  let(:object_name) { 'device' }
141
151
 
142
152
  let(:devices) do
@@ -179,7 +189,7 @@ describe Mrkt::CrudCustomObjects do
179
189
  it { is_expected.to eq(response_stub) }
180
190
  end
181
191
 
182
- describe "#delete_custom_objects" do
192
+ describe '#delete_custom_objects' do
183
193
  let(:object_name) { 'device' }
184
194
 
185
195
  let(:search_fields) do
@@ -199,8 +209,8 @@ describe Mrkt::CrudCustomObjects do
199
209
  success: true,
200
210
  result: [{
201
211
  seq: 0,
202
- status: "deleted",
203
- marketoGUID: "1fc49d4fcb86"
212
+ status: 'deleted',
213
+ marketoGUID: '1fc49d4fcb86'
204
214
  }]
205
215
  }
206
216
  end
@@ -216,8 +226,8 @@ describe Mrkt::CrudCustomObjects do
216
226
  it { is_expected.to eq(response_stub) }
217
227
  end
218
228
 
219
- describe "#get_custom_objects" do
220
- let(:object_name) { 'device'}
229
+ describe '#get_custom_objects' do
230
+ let(:object_name) { 'device' }
221
231
 
222
232
  let(:filter_values) do
223
233
  [{
@@ -234,13 +244,13 @@ describe Mrkt::CrudCustomObjects do
234
244
 
235
245
  let(:response_stub) do
236
246
  {
237
- requestId: "1490d#1528af5232",
247
+ requestId: '1490d#1528af5232',
238
248
  result: [{
239
249
  seq: 0,
240
- marketoGUID: "163b231LPr23200e570",
241
- serialNumber: "serial_number_1",
242
- createdAt: "2016-01-23T05:01:01Z",
243
- updatedAt: "2016-01-29T00:26:00Z"
250
+ marketoGUID: '163b231LPr23200e570',
251
+ serialNumber: 'serial_number_1',
252
+ createdAt: '2016-01-23T05:01:01Z',
253
+ updatedAt: '2016-01-29T00:26:00Z'
244
254
  }],
245
255
  success: true
246
256
  }
@@ -12,7 +12,7 @@ shared_context 'initialized client' do
12
12
  subject(:client) { Mrkt::Client.new(host: host, client_id: client_id, client_secret: client_secret) }
13
13
 
14
14
  before do
15
- stub_request(:get, "https://#{host}/identity/oauth/token")
15
+ @authentication_request_stub = stub_request(:get, "https://#{host}/identity/oauth/token")
16
16
  .with(query: { client_id: client_id, client_secret: client_secret, grant_type: 'client_credentials' })
17
17
  .to_return(json_stub(authentication_stub))
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrkt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - KARASZI István
@@ -9,8 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-10 00:00:00.000000000 Z
12
+ date: 2016-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.9.0
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.11.0
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">"
29
+ - !ruby/object:Gem::Version
30
+ version: 0.9.0
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.11.0
14
34
  - !ruby/object:Gem::Dependency
15
35
  name: faraday_middleware
16
36
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +184,7 @@ files:
164
184
  - lib/mrkt/concerns/authentication.rb
165
185
  - lib/mrkt/concerns/connection.rb
166
186
  - lib/mrkt/concerns/crud_campaigns.rb
187
+ - lib/mrkt/concerns/crud_custom_activities.rb
167
188
  - lib/mrkt/concerns/crud_custom_objects.rb
168
189
  - lib/mrkt/concerns/crud_helpers.rb
169
190
  - lib/mrkt/concerns/crud_leads.rb
@@ -177,6 +198,7 @@ files:
177
198
  - mrkt.gemspec
178
199
  - spec/concerns/authentication_spec.rb
179
200
  - spec/concerns/crud_campaigns_spec.rb
201
+ - spec/concerns/crud_custom_activities_spec.rb
180
202
  - spec/concerns/crud_custom_objects_spec.rb
181
203
  - spec/concerns/crud_leads_spec.rb
182
204
  - spec/concerns/crud_lists_spec.rb
@@ -214,6 +236,7 @@ summary: Marketo REST API Facade
214
236
  test_files:
215
237
  - spec/concerns/authentication_spec.rb
216
238
  - spec/concerns/crud_campaigns_spec.rb
239
+ - spec/concerns/crud_custom_activities_spec.rb
217
240
  - spec/concerns/crud_custom_objects_spec.rb
218
241
  - spec/concerns/crud_leads_spec.rb
219
242
  - spec/concerns/crud_lists_spec.rb