maropost 0.3.1 → 0.3.2

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: 39e6f1d4da90fa3c4c9892b6b6f3b61e3e1d1a6c
4
- data.tar.gz: c897b70a3579757098f9e9d454bff2b892e38b04
3
+ metadata.gz: d46cc851445cb8bb9b24438e695176ccec886f5b
4
+ data.tar.gz: 77fba51fa490defd9d70aa357af6944275138e33
5
5
  SHA512:
6
- metadata.gz: 1ed92b4f9101bedef107aa8208ea13abc5e0c8598cef2b1ec96f91dceae4cc691970e23874d6d063fddc5bd892bd0edcda019ee82c1c7d0f85a547b46388b371
7
- data.tar.gz: 7c5e53edfce997062836955401cc26e9d0c869a86974d7da5b67836016e0edbd4e03dbfb2c5470872082e518d8a2fe68852b021197f5fc42b190745a95971a78
6
+ metadata.gz: 663220a79654e756bf764d93abebd008a07fcacf95ea22fc0d97ff611e5bd4619054cd963024e52ab0c77deb3aab3e8c9c43d920b58c6f93318b91d7100f042e
7
+ data.tar.gz: 155e82c202e4217d3ce0e2cf9bfa06fe1bc5ebf0afc6132a5ab52064ea106d76a5af3af43c612cc4baa47fe763a0d97d517dfe7d1851cf0f6ff8c7011dc49047
data/lib/maropost/api.rb CHANGED
@@ -2,7 +2,7 @@ module Maropost
2
2
  class Api
3
3
  def self.find(email)
4
4
  response = request(:get,
5
- maropost_url('contacts/email.json', "contact[email]=#{email}"))
5
+ maropost_url('contacts/email.json', "contact[email]=#{CGI::escape(email)}"))
6
6
  Maropost::Contact.new(JSON.parse response.body)
7
7
  rescue RestClient::ResourceNotFound
8
8
  nil
@@ -20,8 +20,8 @@ module Maropost
20
20
 
21
21
  def self.create(contact)
22
22
  response = request(:post,
23
- maropost_url('contacts.json'),
24
- create_or_update_payload(contact))
23
+ maropost_url('contacts.json'),
24
+ create_or_update_payload(contact))
25
25
  Maropost::Contact.new(JSON.parse response.body)
26
26
  rescue RestClient::UnprocessableEntity, RestClient::BadRequest => e
27
27
  contact.errors << 'Unable to create or update contact'
@@ -59,24 +59,26 @@ module Maropost
59
59
  def self.create_or_update_payload(contact)
60
60
  {
61
61
  contact:
62
- { email: contact.email,
62
+ {
63
+ email: contact.email,
63
64
  phone: contact.phone_number,
64
- custom_field: {
65
- ama_rewards: contact.ama_rewards,
66
- ama_membership: contact.ama_membership,
67
- ama_insurance: contact.ama_insurance,
68
- ama_travel: contact.ama_travel,
69
- ama_new_member_series: contact.ama_new_member_series,
70
- ama_fleet_safety: contact.ama_fleet_safety,
71
- ovrr_personal: contact.ovrr_personal,
72
- ovrr_business: contact.ovrr_business,
73
- ovrr_associate: contact.ovrr_associate,
74
- ama_vr_reminder: contact.ama_vr_reminder,
75
- ama_vr_reminder_email: contact.ama_vr_reminder_email,
76
- ama_vr_reminder_sms: contact.ama_vr_reminder_sms,
77
- ama_vr_reminder_autocall: contact.ama_vr_reminder_autocall,
78
- cell_phone_number: contact.cell_phone_number
79
- }
65
+ custom_field:
66
+ {
67
+ ama_rewards: contact.ama_rewards,
68
+ ama_membership: contact.ama_membership,
69
+ ama_insurance: contact.ama_insurance,
70
+ ama_travel: contact.ama_travel,
71
+ ama_new_member_series: contact.ama_new_member_series,
72
+ ama_fleet_safety: contact.ama_fleet_safety,
73
+ ovrr_personal: contact.ovrr_personal,
74
+ ovrr_business: contact.ovrr_business,
75
+ ovrr_associate: contact.ovrr_associate,
76
+ ama_vr_reminder: contact.ama_vr_reminder,
77
+ ama_vr_reminder_email: contact.ama_vr_reminder_email,
78
+ ama_vr_reminder_sms: contact.ama_vr_reminder_sms,
79
+ ama_vr_reminder_autocall: contact.ama_vr_reminder_autocall,
80
+ cell_phone_number: contact.cell_phone_number
81
+ }
80
82
  }
81
83
  }
82
84
  end
@@ -2,7 +2,7 @@ module Maropost
2
2
  class DoNotMailList
3
3
  def self.exists?(contact)
4
4
  response = request(:get,
5
- maropost_url('global_unsubscribes/email.json', "contact[email]=#{contact.email}"))
5
+ maropost_url('global_unsubscribes/email.json', "contact[email]=#{CGI::escape(contact.email)}"))
6
6
  JSON.parse response.body
7
7
 
8
8
  response['id'] ? true : false
@@ -25,7 +25,7 @@ module Maropost
25
25
 
26
26
  def self.delete(contact)
27
27
  request(:delete,
28
- maropost_url('global_unsubscribes/delete.json', "email=#{contact.email}"))
28
+ maropost_url('global_unsubscribes/delete.json', "email=#{CGI::escape(contact.email)}"))
29
29
  contact
30
30
  rescue RestClient::UnprocessableEntity, RestClient::BadRequest => e
31
31
  contact.errors << "Unable to unsubscribe contact. Error: #{e.message}"
@@ -1,3 +1,3 @@
1
1
  module Maropost
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maropost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -21,7 +21,7 @@ authors:
21
21
  autorequire:
22
22
  bindir: exe
23
23
  cert_chain: []
24
- date: 2017-10-06 00:00:00.000000000 Z
24
+ date: 2017-10-15 00:00:00.000000000 Z
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rest-client