emarsys 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c006c15b3aa1bc20e0660c77d7003d4d03084db4
4
- data.tar.gz: a9561b3ba62ecf8f9e4830ef615fe4001d415a84
3
+ metadata.gz: 1943af483f1ff4babeca7459c1cf9abfe6f72310
4
+ data.tar.gz: b387277b486845a2a7c1cdcdedf0d40ff7fdb707
5
5
  SHA512:
6
- metadata.gz: 291d6f93c68a17a9a67fa805dc3d8b24f28b0871957f0daa2d54f2e5adb48572c3f85451a218e8b803d827aca0df6c2d7eefbeb7681196a7a5404920506b591a
7
- data.tar.gz: e93647e7963726a2a97c6b177084a4f3d62b52b0262460e66c79d11d7695bb5ce67d82e11ec0a975f5e2e1cd89d41fae39594808431f0d19b873d566284c6123
6
+ metadata.gz: b03ccb71acbabb401381ae3883f204530f168771713fa075c46faf320d8edef785869b4fffc91134cf25c3829c29dc0acc33950815c13eb973d5d423351a50da
7
+ data.tar.gz: 01336632d7109dcd761f1922f5b07da6440f806edf56546a6a3d5cb520b3cd9517caab4104442190043ccf4ac6a5f8e233dcddafb9f714d3f375f976aa3fddbc
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## HEAD (not yet released)
3
+ ## v0.3.1
4
+
5
+ * Export segment ([#31](https://github.com/Absolventa/emarsys-rb/pull/31))
6
+
7
+ ## v0.3.0
4
8
 
5
9
  * Return response, not just (parsed) body of it ([#29](https://github.com/Absolventa/emarsys-rb/pull/29)). To migrate existing code, you need to call `#data` on the
6
10
  response object.
data/README.md CHANGED
@@ -54,6 +54,14 @@ Emarsys.configure(account: :bar) do |c|
54
54
  end
55
55
  ```
56
56
 
57
+ When your application uses only one Emarsys account you will need to add:
58
+
59
+ ```ruby
60
+ Emarsys.allow_default_configuration = true
61
+ ```
62
+
63
+ to your configuration.
64
+
57
65
  ### Field Mapping
58
66
 
59
67
  As said before, Emarsys loves IDs. For using an API, they are evil. This gem provides
@@ -31,6 +31,23 @@ module Emarsys
31
31
  params.merge!(:limit => limit) if limit
32
32
  get account, "export/#{id}/data", params
33
33
  end
34
+
35
+ # Export a segment
36
+ #
37
+ # @param filter [Integer] The segment ID
38
+ # @option distribution_method [String] ftp, sftp, local or mail
39
+ # @option contact_fields [Array] Contact field IDs to export
40
+ # @return [Hash] Result data
41
+ # @example
42
+ # Emarsys::Export.filter(filter: 123, distribution_method: 'local', contact_fields: [1, 3, 106533])
43
+ def filter(filter:, distribution_method:, contact_fields:, account: nil, **params)
44
+ params.merge!(
45
+ filter: filter,
46
+ distribution_method: distribution_method,
47
+ contact_fields: contact_fields
48
+ )
49
+ post account, "export/filter", params
50
+ end
34
51
  end
35
52
 
36
53
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Emarsys
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
@@ -16,4 +16,16 @@ describe Emarsys::Export do
16
16
  ).to have_been_requested.once
17
17
  end
18
18
  end
19
+
20
+ describe ".filter" do
21
+ it "requests a single export" do
22
+ stub = stub_request(:post, "https://api.emarsys.net/api/v2/export/filter").to_return(standard_return_body)
23
+ Emarsys::Export.filter(
24
+ filter: 123,
25
+ distribution_method: 'local',
26
+ contact_fields: [1, 3]
27
+ )
28
+ expect(stub).to have_been_requested.once
29
+ end
30
+ end
19
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emarsys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schoppmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client