mrkt 0.8.0 → 0.9.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: 9c4c184b895beed1d39507db68cd1826fd709588
4
- data.tar.gz: f2fcf806aa0f17d07ee67034eeabe09159ef1b60
3
+ metadata.gz: beebfadd98f11b8793c2be39ed96246c24ca2a52
4
+ data.tar.gz: 4ff4f2b76abafae545b29ead006d4afbd90affb1
5
5
  SHA512:
6
- metadata.gz: eb54c671fa877899ab5161db7446d0b142684a0fed8ed05cf7b3e533827a229a32603e40e6500b971196e91dab13864bd79ef0147d9a523e3eaf2122548ba9d5
7
- data.tar.gz: bfb9caab6508464ecc878d9e0b17a3c69b0f72f75f84d3e611f60aa2e3384d2ef961dd25e4d81f904f81685791e173dac5b809cf16df763e6dfb9a631e5281b9
6
+ metadata.gz: 5cfa98036ebf42268a7cd349f17e09e38df7b8c9e06e8dad87094e588ce43f16e8e0671f2fa86fa7b7074ace75bce4de3629c601704ad6c2656c82e1c93da7b7
7
+ data.tar.gz: 36d67c8ad9811b8e8cd60dd18df61e0d6bc7cae124dc75904c44831d4bafe6d9e6a97782dfd8c39437bd12f7d8783f6b21d613b5d703527f7ec218b5caa6ef7d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mrkt (0.8.0)
4
+ mrkt (0.9.0)
5
5
  faraday (> 0.9.0, < 0.14.0)
6
6
  faraday_middleware (> 0.9.0, < 0.13.0)
7
7
 
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Mrkt
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/raszi/mrkt.png)](http://travis-ci.org/raszi/mrkt)
3
+ [![Build Status](https://travis-ci.org/raszi/mrkt.svg?branch=master)](https://travis-ci.org/raszi/mrkt)
4
4
  [![Code Climate](https://codeclimate.com/github/raszi/mrkt/badges/gpa.svg)](https://codeclimate.com/github/raszi/mrkt)
5
5
  [![Test Coverage](https://codeclimate.com/github/raszi/mrkt/badges/coverage.svg)](https://codeclimate.com/github/raszi/mrkt)
6
+ [![Gem Version](https://badge.fury.io/rb/mrkt.svg)](https://badge.fury.io/rb/mrkt)
6
7
 
7
- This gem provides some level of abstraction to Marketo REST APIs. Please note that this gem is alpha quality.
8
+ This gem provides some level of abstraction to Marketo REST APIs. Please note that this gem is alpha quality.
8
9
 
9
10
 
10
11
  ## Installation
@@ -39,8 +40,8 @@ Get the following from your Marketo admin:
39
40
 
40
41
  ```ruby
41
42
  client = Mrkt::Client.new(
42
- host: '123-abc-123.mktorest.com',
43
- client_id: '4567e1cdf-0fae-4685-a914-5be45043f2d8',
43
+ host: '123-abc-123.mktorest.com',
44
+ client_id: '4567e1cdf-0fae-4685-a914-5be45043f2d8',
44
45
  client_secret: '7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt')
45
46
  ```
46
47
 
@@ -48,8 +49,8 @@ If you need verbosity during troubleshooting, enable debug mode:
48
49
 
49
50
  ```ruby
50
51
  client = Mrkt::Client.new(
51
- host: '123-abc-123.mktorest.com',
52
- client_id: '4567e1cdf-0fae-4685-a914-5be45043f2d8',
52
+ host: '123-abc-123.mktorest.com',
53
+ client_id: '4567e1cdf-0fae-4685-a914-5be45043f2d8',
53
54
  client_secret: '7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt',
54
55
  debug: true,
55
56
  logger: ::Logger.new("log/marketo.log"), # optional, defaults to Faraday default of logging to STDOUT
@@ -9,6 +9,7 @@ require 'mrkt/concerns/crud_campaigns'
9
9
  require 'mrkt/concerns/crud_leads'
10
10
  require 'mrkt/concerns/crud_lists'
11
11
  require 'mrkt/concerns/import_leads'
12
+ require 'mrkt/concerns/import_custom_objects'
12
13
  require 'mrkt/concerns/crud_custom_objects'
13
14
  require 'mrkt/concerns/crud_custom_activities'
14
15
  require 'mrkt/concerns/crud_programs'
@@ -23,6 +24,7 @@ module Mrkt
23
24
  include CrudLeads
24
25
  include CrudLists
25
26
  include ImportLeads
27
+ include ImportCustomObjects
26
28
  include CrudCustomObjects
27
29
  include CrudCustomActivities
28
30
  include CrudPrograms
@@ -0,0 +1,24 @@
1
+ module Mrkt
2
+ module ImportCustomObjects
3
+ def import_custom_object(file, custom_object, format = 'csv')
4
+ params = {
5
+ format: format,
6
+ file: Faraday::UploadIO.new(file, 'text/csv')
7
+ }
8
+
9
+ post("/bulk/v1/customobjects/#{custom_object}/import.json", params)
10
+ end
11
+
12
+ def import_custom_object_status(id, custom_object)
13
+ get("/bulk/v1/customobjects/#{custom_object}/import/#{id}/status.json")
14
+ end
15
+
16
+ def import_custom_object_failures(id, custom_object)
17
+ get("/bulk/v1/customobjects/#{custom_object}/import/#{id}/failures.json")
18
+ end
19
+
20
+ def import_custom_object_warnings(id, custom_object)
21
+ get("/bulk/v1/customobjects/#{custom_object}/import/#{id}/warnings.json")
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Mrkt
2
- VERSION = '0.8.0'
2
+ VERSION = '0.9.0'
3
3
  end
@@ -0,0 +1,89 @@
1
+ require 'tempfile'
2
+
3
+ describe Mrkt::ImportCustomObjects do
4
+ include_context 'initialized client'
5
+ let(:custom_object) { 'car_c' }
6
+
7
+ describe '#import_custom_object' do
8
+ let(:file) { StringIO.new }
9
+ let(:response_stub) do
10
+ {
11
+ requestId: 'c015#15a68a23418',
12
+ success: true,
13
+ result: [
14
+ {
15
+ batchId: 1,
16
+ status: 'Importing',
17
+ objectApiName: custom_object
18
+ }
19
+ ]
20
+ }
21
+ end
22
+ subject { client.import_custom_object(file, custom_object) }
23
+
24
+ before do
25
+ stub_request(:post, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import.json")
26
+ .with(headers: { content_type: %r{multipart/form-data; boundary=\S+} })
27
+ .to_return(json_stub(response_stub))
28
+ end
29
+
30
+ it { is_expected.to eq(response_stub) }
31
+ end
32
+
33
+ describe '#import_custom_object_status' do
34
+ let(:id) { 1 }
35
+ let(:response_stub) do
36
+ {
37
+ requestId: '2a5#15a68dd9be1',
38
+ result: [
39
+ {
40
+ batchId: id,
41
+ operation: 'import',
42
+ status: 'Complete',
43
+ objectApiName: 'car_c',
44
+ numOfObjectsProcessed: 3,
45
+ numOfRowsFailed: 0,
46
+ numOfRowsWithWarning: 0,
47
+ importTime: '2 second(s)',
48
+ message: 'Import succeeded, 3 records imported (3 members)'
49
+ }
50
+ ],
51
+ success: true
52
+ }
53
+ end
54
+ subject { client.import_custom_object_status(1, custom_object) }
55
+
56
+ before do
57
+ stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/status.json")
58
+ .to_return(json_stub(response_stub))
59
+ end
60
+
61
+ it { is_expected.to eq(response_stub) }
62
+ end
63
+
64
+ describe '#import_custom_object_failures' do
65
+ let(:id) { 1 }
66
+ let(:response_stub) { '' }
67
+ subject { client.import_custom_object_failures(1, custom_object) }
68
+
69
+ before do
70
+ stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/failures.json")
71
+ .to_return(headers: { content_length: 0 })
72
+ end
73
+
74
+ it { is_expected.to eq(response_stub) }
75
+ end
76
+
77
+ describe '#import_custom_object_warnings' do
78
+ let(:id) { 1 }
79
+ let(:response_stub) { '' }
80
+ subject { client.import_custom_object_warnings(1, custom_object) }
81
+
82
+ before do
83
+ stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/warnings.json")
84
+ .to_return(headers: { content_length: 0 })
85
+ end
86
+
87
+ it { is_expected.to eq(response_stub) }
88
+ end
89
+ 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.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - KARASZI István
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-03 00:00:00.000000000 Z
12
+ date: 2017-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -191,6 +191,7 @@ files:
191
191
  - lib/mrkt/concerns/crud_leads.rb
192
192
  - lib/mrkt/concerns/crud_lists.rb
193
193
  - lib/mrkt/concerns/crud_programs.rb
194
+ - lib/mrkt/concerns/import_custom_objects.rb
194
195
  - lib/mrkt/concerns/import_leads.rb
195
196
  - lib/mrkt/errors.rb
196
197
  - lib/mrkt/faraday_middleware.rb
@@ -205,6 +206,7 @@ files:
205
206
  - spec/concerns/crud_leads_spec.rb
206
207
  - spec/concerns/crud_lists_spec.rb
207
208
  - spec/concerns/crud_programs_spec.rb
209
+ - spec/concerns/import_custom_objects_spec.rb
208
210
  - spec/concerns/import_leads_spec.rb
209
211
  - spec/errors_spec.rb
210
212
  - spec/mkto_rest_spec.rb
@@ -244,6 +246,7 @@ test_files:
244
246
  - spec/concerns/crud_leads_spec.rb
245
247
  - spec/concerns/crud_lists_spec.rb
246
248
  - spec/concerns/crud_programs_spec.rb
249
+ - spec/concerns/import_custom_objects_spec.rb
247
250
  - spec/concerns/import_leads_spec.rb
248
251
  - spec/errors_spec.rb
249
252
  - spec/mkto_rest_spec.rb