emarsys 0.3.13 → 0.5.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
- SHA1:
3
- metadata.gz: 438c871d801d4782d2e87ed2fc095847b5323a64
4
- data.tar.gz: 9d01a343ecb897f827d3b0e543fb08382e73d540
2
+ SHA256:
3
+ metadata.gz: 6b81b5ea5557ce933b016de58af06badeb2b1ee6b031d77f347bb6d1f9e0d35c
4
+ data.tar.gz: '0619224ab0ba8a19979790f05dee342178ad8e19e609ec2633414e93b4c6207f'
5
5
  SHA512:
6
- metadata.gz: c1b1ae69f75b6d77168dee74a56166942266084119f7ba169b3eecf7726bfdd6ef1d4e810195b014bcf3564d6a97f3e1bb1e254638abf0545d54f9ee4e0d7844
7
- data.tar.gz: f846c1d9637cf3050fca1b249df4023f1ea6e2f766cec60eb3c46f8ddb9b53b41c91ca47df081d9fa2f4f0f6384c52152b8d11402c5859808d879da38b5cea52
6
+ metadata.gz: 2bbfd1f981a63b2758326af0db33bdb5267f60de7128c1211335e8c2b2da861aaf080d13d5b5c9f172e5362ea647e41e625fbaf796506fcd51c12d01ff43e72c
7
+ data.tar.gz: 1699e55fc9459ce7c84f84b73a1bccbebacbb041f6631b1c73fa9ed388e88e98bc63aa7d68fb44645a3dff565d8fbfd561913a09ca205a7f5dbc833ccbf9f53b
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .idea/*
1
2
  *.gem
2
3
  *.rbc
3
4
  .bundle
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  sudo: false
3
- cache:
4
- bundler: true
3
+ before_install:
4
+ - gem install bundler
5
5
  rvm:
6
- - jruby-9.0.5.0
7
- - 2.2.2
6
+ - jruby-9.2.11.0
8
7
  - 2.3.1
8
+ - 2.5.8
data/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Changelog
2
2
 
3
- ## v0.3.13
3
+ ## v1.4.1
4
+
5
+ * Allow nonspecific arguments for the `export_registrations` call
6
+
7
+ ## v1.4.0 - DIVERTED FROM ORIGINAL PROJECT
8
+
9
+ * Fix add attributes method ([#67](https://github.com/Absolventa/emarsys-rb/pull/67))
10
+ * Fix CSV data export ([#68](https://github.com/Absolventa/emarsys-rb/pull/68))
11
+ * Other minor fixes, typos and gem updates
12
+
13
+ ## v0.4.0
14
+
15
+ * Add supported segment endpoints and remove the deprecated one ([#64](https://github.com/Absolventa/emarsys-rb/pull/64))
16
+
17
+ ## v0.3.13
4
18
 
5
19
  * Add method to delete ContactList by ID ([#63](https://github.com/Absolventa/emarsys-rb/pull/63))
6
20
  * Use correct endpoint in ContactList.remove_contacts ([#62](https://github.com/Absolventa/emarsys-rb/pull/62))
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Simple Ruby wrapper for the Emarsys API.
4
4
 
5
+ ## Note
6
+
7
+ This fork was created because the original author doesn't seem to be merging PRs anymore. If that gets rectified, I'll close this repo. In the meantime I'll start release from the original version + 1.0.0 (e.g. 0.4.0 -> 1.4.0).
8
+
5
9
  ## Installation
6
10
 
7
11
  gem install emarsys
@@ -12,16 +16,16 @@ This wrapper tries to implement all available methods of the Emarsys API in a
12
16
  Ruby-like fashion. However, the Emarsys API lacks a decent amount of methods that
13
17
  you expect an API to provide.
14
18
  Thus, if methods are missing or a certain implementation
15
- style was choosen it is most likely due to the inconsistency of the API itself.
19
+ style was chosen it is most likely due to the inconsistency of the API itself.
16
20
  Feel free to get in touch or submit a pull request if you encounter any problems.
17
21
 
18
22
  Must-known facts about the Emarsys API:
19
23
 
20
24
  * Emarsys uses internal IDs as field identifiers. E.g. 'email' is mapped to the value 3.
21
25
  This gem tries to work around this by letting you specify a field mapping constant.
22
- * certain methods require the specification of a key-field, e.g. the email (internally refered to as '3' again).
26
+ * certain methods require the specification of a key-field, e.g. the email (internally referred to as '3' again).
23
27
  * Return values differ from method to method due to the way the Emarsys API is implemented.
24
- Thus, a Hash as a return value or an Array of Hashes was choosen as the global return object. Basically it is a parsed JSON response.
28
+ Thus, a Hash as a return value or an Array of Hashes was chosen as the global return object. Basically it is a parsed JSON response.
25
29
  * Please refer to the Emarsys API documentation for detailed information on parameters, return values or error codes.
26
30
  * The list of available countries is defined by Emarsys, and uses internal Emarsys-specific IDs. A utility class is
27
31
  provided to map [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 "ISO 3166-1 alpha-2") data (aka 2-letter country codes) to internal Emarsys country IDs.
@@ -161,6 +165,9 @@ Emarsys::ContactList.create
161
165
 
162
166
  # Delete a contact list
163
167
  Emarsys::ContactList.delete(123)
168
+
169
+ # List all contacts in a contact list
170
+ Emarsys::ContactList.contacts(123)
164
171
  ```
165
172
 
166
173
  #### Emails
@@ -235,8 +242,13 @@ Emarsys::Segment.collection
235
242
  ```
236
243
 
237
244
  ```ruby
238
- # List contacts in a segment
239
- Emarsys::Segment.contacts(123, limit: 2000)
245
+ # Run a segment for multiple contacts
246
+ Emarsys::Segment.run(123)
247
+ ```
248
+
249
+ ```ruby
250
+ # Check the status of a segment run
251
+ Emarsys::Segment.status('foo123')
240
252
  ```
241
253
 
242
254
  #### Source
data/emarsys.gemspec CHANGED
@@ -4,25 +4,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'emarsys/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "emarsys"
8
- spec.version = Emarsys::VERSION
9
- spec.authors = ["Daniel Schoppmann"]
10
- spec.email = ["daniel.schoppmann@absolventa.de"]
11
- spec.description = %q{A Ruby library for interacting with the Emarsys API.}
12
- spec.summary = %q{Easy to use ruby library for Emarsys Marketing Suite.}
13
- spec.homepage = "https://github.com/Absolventa/emarsys-rb"
14
- spec.license = "MIT"
7
+ spec.name = "emarsys"
8
+ spec.version = Emarsys::VERSION
9
+ spec.authors = ["Daniel Schoppmann", "Palatinate Tech", "Rory Sinclair"]
10
+ spec.email = [ "daniel.schoppmann@absolventa.de", "info@palatinategroup.com","rory@asw.com"]
11
+ spec.description = %q{A Ruby library for interacting with the Emarsys API.}
12
+ spec.summary = %q{Easy to use ruby library for Emarsys Marketing Suite.}
13
+ spec.homepage = "https://github.com/ygt/emarsys-rb"
14
+ spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.metadata = {
17
+ "github_repo" => "ssh://github.com/Absolventa/emarsys-rb"
18
+ }
19
+
20
+ spec.files = `git ls-files`.split($/)
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
23
  spec.require_paths = ["lib"]
24
+ spec.required_ruby_version = '>= 2.3'
20
25
 
21
- spec.add_dependency "rest-client"
26
+ spec.add_dependency "rest-client", "~> 2.1.0"
22
27
 
23
- spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec", ">= 3.5.0"
26
- spec.add_development_dependency "webmock", "< 2.0"
27
- spec.add_development_dependency "timecop"
28
+ spec.add_development_dependency "bundler", "~> 2.2.4"
29
+ spec.add_development_dependency "rake", "~> 13.0.6"
30
+ spec.add_development_dependency "rspec", "~> 3.10.0"
31
+ spec.add_development_dependency "webmock", "~> 3.14.0"
32
+ spec.add_development_dependency "timecop", "~> 0.9.4"
28
33
  end
@@ -26,7 +26,7 @@ module Emarsys
26
26
  end
27
27
 
28
28
  def header_password_digest
29
- Base64.encode64(calculated_digest).gsub("\n", "")
29
+ Base64.strict_encode64(calculated_digest).strip
30
30
  end
31
31
 
32
32
  def header_nonce
@@ -14,8 +14,8 @@ module Emarsys
14
14
  # @param params [Hash] Contact information to create
15
15
  # @return [Hash] internal id of the contact
16
16
  # @example
17
- # Emarsys::Contact.create('app_id', 23, {:firstname => "Jon", :lastname => "Doe"})
18
- # Emarsys::Contact.create('3', 'john.doe@example.com', {'1' => "Jon", '2' => "Doe"})
17
+ # Emarsys::Contact.create(key_id: 'app_id', key_value: 23, params: {:firstname => "Jon", :lastname => "Doe"})
18
+ # Emarsys::Contact.create(key_id: '3', key_value: 'john.doe@example.com', params: {'1' => "Jon", '2' => "Doe"})
19
19
  def create(key_id:, key_value:, params: {}, account: nil)
20
20
  transformed_key_id = transform_key_id(key_id)
21
21
  post account, "contact", params.merge!({'key_id' => transformed_key_id, transformed_key_id => key_value})
@@ -27,8 +27,8 @@ module Emarsys
27
27
  # @param key_value [Integer, String] value of internal id field
28
28
  # @return [Hash] internal emarsys id of the contact
29
29
  # @example
30
- # Emarsys::Contact.emarsys_id('email', 'john.dow@example.com')
31
- # Emarsys::Contact.emarsys_id(1, 'John')
30
+ # Emarsys::Contact.emarsys_id(key_id: 'email', key_value: 'john.dow@example.com')
31
+ # Emarsys::Contact.emarsys_id(key_id: 1, key_value: 'John')
32
32
  def emarsys_id(key_id:, key_value:, account: nil)
33
33
  get account, "contact", {"#{transform_key_id(key_id).to_s}" => key_value}
34
34
  end
@@ -41,8 +41,8 @@ module Emarsys
41
41
  # @param create_if_not_exists [Boolean] Whether to create contact if it does not exist
42
42
  # @return [Hash] internal id of the contact
43
43
  # @example
44
- # Emarsys::Contact.update('app_id', 23, {:firstname => "Jon", :lastname => "Doe"})
45
- # Emarsys::Contact.update('3', 'john.doe@example.com', {'1' => "Jon", '2' => "Doe"}, true)
44
+ # Emarsys::Contact.update(key_id: 'app_id', key_value: 23, params: {:firstname => "Jon", :lastname => "Doe"})
45
+ # Emarsys::Contact.update(key_id: '3', key_value: 'john.doe@example.com', params: {'1' => "Jon", '2' => "Doe"}, true)
46
46
  def update(key_id:, key_value:, params: {}, create_if_not_exists: false, account: nil)
47
47
  path = "contact#{create_if_not_exists ? '/?create_if_not_exists=1' : ''}"
48
48
  transformed_key_id = transform_key_id(key_id)
@@ -55,8 +55,11 @@ module Emarsys
55
55
  # @param params [Hash] Contact information of each new contact
56
56
  # @example
57
57
  # Emarsys::Contact.create_batch(
58
- # 'email', {:app_id => 1, :firstname => "Jon", :lastname => "Doe"},
59
- # {:app_id => 2, :firstname => "Jane", :lastname => "Doe"}
58
+ # key_id: 'email',
59
+ # params: [
60
+ # {:app_id => 1, :firstname => "Jon", :lastname => "Doe"},
61
+ # {:app_id => 2, :firstname => "Jane", :lastname => "Doe"}
62
+ # ]
60
63
  # )
61
64
  #
62
65
  def create_batch(key_id:, params: [], account: nil)
@@ -70,10 +73,12 @@ module Emarsys
70
73
  # @param create_if_not_exists [Boolean] Whether to create non-existing contacts
71
74
  # @example
72
75
  # Emarsys::Contact.update_batch(
73
- # 'email',
74
- # [{:email => "john@example.com", :firstname => "Jon", :lastname => "Doe"},
75
- # {:email => "jane@example.com", :firstname => "Jane", :lastname => "Doe"}],
76
- # true
76
+ # key_id: 'email',
77
+ # params: [
78
+ # {:email => "john@example.com", :firstname => "Jon", :lastname => "Doe"},
79
+ # {:email => "jane@example.com", :firstname => "Jane", :lastname => "Doe"}
80
+ # ],
81
+ # create_if_not_exists: true
77
82
  # )
78
83
  #
79
84
  def update_batch(key_id:, params: [], create_if_not_exists: false, account: nil)
@@ -87,8 +92,8 @@ module Emarsys
87
92
  # @param key_value [Integer, String] value of internal id field
88
93
  # @return [Hash]
89
94
  # @example
90
- # Emarsys::Contact.update('app_id', 23, {:firstname => "Jon", :lastname => "Doe"})
91
- # Emarsys::Contact.update('3', 'john.doe@example.com', {'1' => "Jon", '2' => "Doe"}, true)
95
+ # Emarsys::Contact.delete(key_id: 'app_id', key_value: 23)
96
+ # Emarsys::Contact.delete(key_id: '3', key_value: 'john.doe@example.com')
92
97
  def delete(key_id:, key_value:, account: nil)
93
98
  path = "contact/delete"
94
99
  transformed_key_id = transform_key_id(key_id)
@@ -100,7 +105,7 @@ module Emarsys
100
105
  # @param contacts [array] Array of contact ids
101
106
  # @return [Hash] result data
102
107
  # @example
103
- # Emarsys::Contact.contact_history([1,2,3]
108
+ # Emarsys::Contact.contact_history(contacts: [1,2,3]
104
109
  def contact_history(contacts:, account: nil)
105
110
  post account, "contact/getcontacthistory", {'contacts' => contacts}
106
111
  end
@@ -112,7 +117,7 @@ module Emarsys
112
117
  # @param fields [array] requested fields. If empty, all are considered
113
118
  # @return [Hash] result data
114
119
  # @example
115
- # Emarsys::Contact.search('3', ['john.doe@example.com'], [1,2,3])
120
+ # Emarsys::Contact.search(key_id: '3', key_value: ['john.doe@example.com'], fields: [1,2,3])
116
121
  #
117
122
  # TODO transform fields to numeric fields
118
123
  def search(key_id:, key_values:, fields: [], account: nil)
@@ -150,12 +155,13 @@ module Emarsys
150
155
  # @return [Hash] result data
151
156
  # @example
152
157
  # Emarsys::Contact.export_registrations(distribution_method: 'local', time_range: ["2013-01-01","2013-12-31"], contact_fields: [1,2,3])
153
- def export_registrations(distribution_method:, time_range:, contact_fields:, account: nil)
154
- post account, "contact/getregistrations", {
158
+ def export_registrations(distribution_method:, time_range:, contact_fields:, account: nil, **params)
159
+ params.merge!(
155
160
  distribution_method: distribution_method,
156
161
  time_range: time_range,
157
162
  contact_fields: contact_fields
158
- }
163
+ )
164
+ post account, "contact/getregistrations", params
159
165
  end
160
166
 
161
167
  # @private
@@ -16,6 +16,14 @@ module Emarsys
16
16
  get account, 'contactlist', {}
17
17
  end
18
18
 
19
+ # List contacts in a contact list
20
+ # Reference: https://dev.emarsys.com/v2/contact-lists/list-contacts-in-a-contact-list
21
+ #
22
+ # @param id [Integer] The contact list id
23
+ def contacts(id, account: nil)
24
+ get account, "contactlist/#{id}/", {}
25
+ end
26
+
19
27
  # Create a new contact list
20
28
  #
21
29
  # @param params [Hash] Contact list information to create
@@ -86,10 +86,10 @@ module Emarsys
86
86
  params = {}
87
87
 
88
88
  if !launch_id.nil?
89
- params.merge!(launch_id: launch_id)
89
+ params.merge!(launch_id: launch_id)
90
90
  end
91
91
 
92
- if !start_date.nil?
92
+ if !start_date.nil?
93
93
  params.merge!(start_date: start_date)
94
94
  end
95
95
 
@@ -141,7 +141,7 @@ module Emarsys
141
141
  def unsubscribe(account: nil, **params)
142
142
  post account, "email/unsubscribe", params
143
143
  end
144
-
144
+
145
145
  # https://help.emarsys.com/hc/en-us/articles/115004523714
146
146
  def email_launches(id, account: nil)
147
147
  post account, "email/getlaunchesofemail", emailId: id
@@ -159,11 +159,11 @@ module Emarsys
159
159
  # @return [Hash] Result data
160
160
  # @example
161
161
  # Emarsys::Email.export_responses(
162
- # 'local',
163
- # ['2012-02-09', '2014-08-13'],
164
- # [1, 3],
165
- # ['trackable_links'],
166
- # [5, 8, 13]
162
+ # distribution_method: 'local',
163
+ # time_range: ['2012-02-09', '2014-08-13'],
164
+ # contact_fields: [1, 3],
165
+ # sources: ['trackable_links'],
166
+ # analysis_fields: [5, 8, 13]
167
167
  # )
168
168
  def export_responses(distribution_method:, time_range:, contact_fields:, sources:, analysis_fields:, account: nil, **params)
169
169
  params.merge!(
@@ -16,17 +16,22 @@ module Emarsys
16
16
  get account, 'filter', {}
17
17
  end
18
18
 
19
- # List ids of contacts in a segment.
20
- # Raises Emarsys::SegmentIsEvaluated if the segment is being currently evaluated.
21
- # Reference: https://dev.emarsys.com/v2/response-codes/http-202-errors
22
- # The `limit` param is required by this endpoint although it is marked as optional in the API v2 doc.
19
+ # Run a Segment for Multiple Contacts
20
+ # Reference: https://dev.emarsys.com/v2/segments/run-a-contact-segment-batch
23
21
  #
24
22
  # @param id [Integer] the id of the segment
25
- # @param limit [Integer] the maximum number of records to return
26
- # @param offset [Integer] optional offset value for pagination
27
- def contacts(id, limit:, offset: 0, account: nil)
28
- path = "filter/#{id}/contacts"
29
- get account, path, limit: limit, offset: offset
23
+ def run(id, account: nil)
24
+ path = "filter/#{id}/runs"
25
+ post account, path, {}
26
+ end
27
+
28
+ # Poll the Status of a Segment Run for Multiple Contacts
29
+ # Reference: https://dev.emarsys.com/v2/segments/poll-the-status-of-a-segment-run-for-multiple-contacts
30
+ #
31
+ # @param run_id [String] the id of the segment run, @see #run
32
+ def status(run_id, account: nil)
33
+ path = "filter/runs/#{run_id}"
34
+ get account, path, {}
30
35
  end
31
36
  end
32
37
  end
data/lib/emarsys/error.rb CHANGED
@@ -28,10 +28,6 @@ module Emarsys
28
28
  # Raised when Emarsys returns a 500 HTTP status code
29
29
  class InternalServerError < Error; end
30
30
 
31
- # Raised when Emarsys returns a 202 HTTP status code with 10001 Reply Code
32
- # https://dev.emarsys.com/v2/response-codes/http-202-errors
33
- class SegmentIsEvaluated < Error; end
34
-
35
31
  class AccountNotConfigured < StandardError; end
36
32
 
37
33
  class AccountRequired < StandardError; end
@@ -65,7 +65,7 @@ module Emarsys::FieldMapping
65
65
  end
66
66
 
67
67
  def self.add_attributes(attrs)
68
- @custom_attributes.concat([attrs].flatten)
68
+ attributes.concat([attrs].flatten)
69
69
  end
70
70
 
71
71
  def self.excluded_default_attributes?
@@ -4,7 +4,7 @@ module Emarsys
4
4
  attr_accessor :code, :text, :data, :status
5
5
 
6
6
  def initialize(response)
7
- if response.headers[:content_type] == 'text/csv'
7
+ if response.headers[:content_type]&.start_with?('text/csv')
8
8
  self.code = 0
9
9
  self.data = response.body
10
10
  else
@@ -21,8 +21,6 @@ module Emarsys
21
21
  raise Emarsys::Unauthorized.new(code, text, status)
22
22
  elsif status == 429
23
23
  raise Emarsys::TooManyRequests.new(code, text, status)
24
- elsif status == 202 && code == 10001
25
- raise Emarsys::SegmentIsEvaluated.new(code, text, status)
26
24
  else
27
25
  raise Emarsys::BadRequest.new(code, text, status)
28
26
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Emarsys
3
- VERSION = "0.3.13"
3
+ VERSION = "0.5.0"
4
4
  end
@@ -47,12 +47,12 @@ describe Emarsys::Client do
47
47
  end
48
48
 
49
49
  it 'encodes string with Base64' do
50
- expect(Base64).to receive(:encode64).with("something").and_return("something_base64_encoded")
50
+ expect(Base64).to receive(:strict_encode64).with("something").and_return("something_base64_encoded")
51
51
  Emarsys::Client.new.header_password_digest
52
52
  end
53
53
 
54
54
  it 'strips of \n character' do
55
- expect(Base64).to receive(:encode64).with("something").and_return("something_base64_encoded\n")
55
+ expect(Base64).to receive(:strict_encode64).with("something").and_return("something_base64_encoded\n")
56
56
  expect(Emarsys::Client.new.header_password_digest).to eq("something_base64_encoded")
57
57
  end
58
58
  end
@@ -8,4 +8,11 @@ describe Emarsys::ContactList do
8
8
  ).to have_been_requested.once
9
9
  end
10
10
  end
11
+ describe ".contacts" do
12
+ it "requests all contacts in the given contact list" do
13
+ expect(
14
+ stub_get("contactlist/123/") { Emarsys::ContactList.contacts(123) }
15
+ ).to have_been_requested.once
16
+ end
17
+ end
11
18
  end
@@ -118,7 +118,7 @@ describe Emarsys::Contact do
118
118
 
119
119
  describe ".export_registrations" do
120
120
  it "requests contact data export based on parameters" do
121
- stub_params = {distribution_method: 'local', time_range: ["2013-01-01","2013-12-31"], contact_fields: [1,2,3]}
121
+ stub_params = {add_field_names_header: 0, distribution_method: 'local', time_range: ["2013-01-01","2013-12-31"], contact_fields: [1,2,3]}
122
122
  stub = stub_request(:post, "https://api.emarsys.net/api/v2/contact/getregistrations").with(:body => stub_params.to_json).to_return(standard_return_body)
123
123
  Emarsys::Contact.export_registrations(stub_params)
124
124
  expect(stub).to have_been_requested.once
@@ -7,11 +7,18 @@ describe Emarsys::Segment do
7
7
  stub_get("filter") { Emarsys::Segment.collection }
8
8
  ).to have_been_requested.once
9
9
  end
10
- describe ".contacts" do
11
- it "requests contact data for a given segment" do
12
- stub = stub_request(:get, "https://api.emarsys.net/api/v2/filter/123/contacts/?limit=2000&offset=0").to_return(standard_return_body)
13
- Emarsys::Segment.contacts(123, limit: 2000)
14
- expect(stub).to have_been_requested.once
10
+ describe ".run" do
11
+ it "requests a run for a segment for multiple contacts" do
12
+ expect(
13
+ stub_post("filter/123/runs") { Emarsys::Segment.run(123) }
14
+ ).to have_been_requested.once
15
+ end
16
+ end
17
+ describe ".status" do
18
+ it "requests the status of the given segment run" do
19
+ expect(
20
+ stub_get("filter/runs/foo-333-bar") { Emarsys::Segment.status('foo-333-bar') }
21
+ ).to have_been_requested.once
15
22
  end
16
23
  end
17
24
  end
@@ -66,8 +66,15 @@ describe Emarsys::FieldMapping do
66
66
  {:id => 101, :identifier => 'foo', :name => 'Foo'},
67
67
  {:id => 102, :identifier => 'bar', :name => 'Bar'}
68
68
  ]
69
- Emarsys::FieldMapping.add_attributes(attributes)
70
- expect(Emarsys::FieldMapping.attributes).to include(attributes[0], attributes[1])
69
+
70
+ stub_const('Emarsys::FieldMapping::ATTRIBUTES', attributes)
71
+
72
+ mapping_to_be_added = {
73
+ id: 2000, identifier: 'baz', name: 'Baz'
74
+ }
75
+
76
+ Emarsys::FieldMapping.add_attributes(mapping_to_be_added)
77
+ expect(Emarsys::FieldMapping.attributes).to include(attributes[0], attributes[1], mapping_to_be_added)
71
78
  end
72
79
  end
73
80
 
@@ -22,7 +22,7 @@ describe Emarsys::Response do
22
22
 
23
23
  module CSV
24
24
  def headers
25
- {:content_type => 'text/csv'}
25
+ {:content_type => 'text/csv;charset=UTF-8'}
26
26
  end
27
27
  end
28
28
  end
@@ -78,14 +78,6 @@ describe Emarsys::Response do
78
78
  allow(fake_response).to receive(:code).and_return(429)
79
79
  expect{response}.to raise_error(Emarsys::TooManyRequests)
80
80
  end
81
-
82
- context 'with Reply Code 10001' do
83
- let(:reply_code) { 10001 }
84
- it "raises SegmentIsEvaluated error if http-status i 202" do
85
- allow(fake_response).to receive(:code).and_return(202)
86
- expect{response}.to raise_error(Emarsys::SegmentIsEvaluated)
87
- end
88
- end
89
81
  end
90
82
 
91
83
  end
metadata CHANGED
@@ -1,102 +1,106 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emarsys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schoppmann
8
- autorequire:
8
+ - Palatinate Tech
9
+ - Rory Sinclair
10
+ autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
13
+ date: 2024-09-17 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: rest-client
15
17
  requirement: !ruby/object:Gem::Requirement
16
18
  requirements:
17
- - - ">="
19
+ - - "~>"
18
20
  - !ruby/object:Gem::Version
19
- version: '0'
21
+ version: 2.1.0
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
- - - ">="
26
+ - - "~>"
25
27
  - !ruby/object:Gem::Version
26
- version: '0'
28
+ version: 2.1.0
27
29
  - !ruby/object:Gem::Dependency
28
30
  name: bundler
29
31
  requirement: !ruby/object:Gem::Requirement
30
32
  requirements:
31
33
  - - "~>"
32
34
  - !ruby/object:Gem::Version
33
- version: '1.3'
35
+ version: 2.2.4
34
36
  type: :development
35
37
  prerelease: false
36
38
  version_requirements: !ruby/object:Gem::Requirement
37
39
  requirements:
38
40
  - - "~>"
39
41
  - !ruby/object:Gem::Version
40
- version: '1.3'
42
+ version: 2.2.4
41
43
  - !ruby/object:Gem::Dependency
42
44
  name: rake
43
45
  requirement: !ruby/object:Gem::Requirement
44
46
  requirements:
45
- - - ">="
47
+ - - "~>"
46
48
  - !ruby/object:Gem::Version
47
- version: '0'
49
+ version: 13.0.6
48
50
  type: :development
49
51
  prerelease: false
50
52
  version_requirements: !ruby/object:Gem::Requirement
51
53
  requirements:
52
- - - ">="
54
+ - - "~>"
53
55
  - !ruby/object:Gem::Version
54
- version: '0'
56
+ version: 13.0.6
55
57
  - !ruby/object:Gem::Dependency
56
58
  name: rspec
57
59
  requirement: !ruby/object:Gem::Requirement
58
60
  requirements:
59
- - - ">="
61
+ - - "~>"
60
62
  - !ruby/object:Gem::Version
61
- version: 3.5.0
63
+ version: 3.10.0
62
64
  type: :development
63
65
  prerelease: false
64
66
  version_requirements: !ruby/object:Gem::Requirement
65
67
  requirements:
66
- - - ">="
68
+ - - "~>"
67
69
  - !ruby/object:Gem::Version
68
- version: 3.5.0
70
+ version: 3.10.0
69
71
  - !ruby/object:Gem::Dependency
70
72
  name: webmock
71
73
  requirement: !ruby/object:Gem::Requirement
72
74
  requirements:
73
- - - "<"
75
+ - - "~>"
74
76
  - !ruby/object:Gem::Version
75
- version: '2.0'
77
+ version: 3.14.0
76
78
  type: :development
77
79
  prerelease: false
78
80
  version_requirements: !ruby/object:Gem::Requirement
79
81
  requirements:
80
- - - "<"
82
+ - - "~>"
81
83
  - !ruby/object:Gem::Version
82
- version: '2.0'
84
+ version: 3.14.0
83
85
  - !ruby/object:Gem::Dependency
84
86
  name: timecop
85
87
  requirement: !ruby/object:Gem::Requirement
86
88
  requirements:
87
- - - ">="
89
+ - - "~>"
88
90
  - !ruby/object:Gem::Version
89
- version: '0'
91
+ version: 0.9.4
90
92
  type: :development
91
93
  prerelease: false
92
94
  version_requirements: !ruby/object:Gem::Requirement
93
95
  requirements:
94
- - - ">="
96
+ - - "~>"
95
97
  - !ruby/object:Gem::Version
96
- version: '0'
98
+ version: 0.9.4
97
99
  description: A Ruby library for interacting with the Emarsys API.
98
100
  email:
99
101
  - daniel.schoppmann@absolventa.de
102
+ - info@palatinategroup.com
103
+ - rory@asw.com
100
104
  executables: []
101
105
  extensions: []
102
106
  extra_rdoc_files: []
@@ -165,11 +169,12 @@ files:
165
169
  - spec/emarsys/response_spec.rb
166
170
  - spec/emarsys_spec.rb
167
171
  - spec/spec_helper.rb
168
- homepage: https://github.com/Absolventa/emarsys-rb
172
+ homepage: https://github.com/ygt/emarsys-rb
169
173
  licenses:
170
174
  - MIT
171
- metadata: {}
172
- post_install_message:
175
+ metadata:
176
+ github_repo: ssh://github.com/Absolventa/emarsys-rb
177
+ post_install_message:
173
178
  rdoc_options: []
174
179
  require_paths:
175
180
  - lib
@@ -177,16 +182,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
182
  requirements:
178
183
  - - ">="
179
184
  - !ruby/object:Gem::Version
180
- version: '0'
185
+ version: '2.3'
181
186
  required_rubygems_version: !ruby/object:Gem::Requirement
182
187
  requirements:
183
188
  - - ">="
184
189
  - !ruby/object:Gem::Version
185
190
  version: '0'
186
191
  requirements: []
187
- rubyforge_project:
188
- rubygems_version: 2.4.5.4
189
- signing_key:
192
+ rubygems_version: 3.4.10
193
+ signing_key:
190
194
  specification_version: 4
191
195
  summary: Easy to use ruby library for Emarsys Marketing Suite.
192
196
  test_files: