mailshake-ruby 0.1.0

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.
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Mailshake::Recipients do
6
+ let(:recipients) { described_class.new(Mailshake.client) }
7
+ let(:base_url) { "https://api.mailshake.com/2017-04-01" }
8
+
9
+ describe "#add" do
10
+ it "adds recipients to a campaign" do
11
+ stub_request(:post, "#{base_url}/recipients/add")
12
+ .with(body: { campaignID: 1, addresses: [{ emailAddress: "john@example.com" }] }.to_json)
13
+ .to_return(status: 200, body: { statusID: 10 }.to_json,
14
+ headers: { "Content-Type" => "application/json" })
15
+
16
+ result = recipients.add(campaign_id: 1, addresses: [{ emailAddress: "john@example.com" }])
17
+ expect(result["statusID"]).to eq(10)
18
+ end
19
+ end
20
+
21
+ describe "#add_status" do
22
+ it "checks add status" do
23
+ stub_request(:get, "#{base_url}/recipients/add-status")
24
+ .with(query: { statusID: "10" })
25
+ .to_return(status: 200, body: { isFinished: true }.to_json,
26
+ headers: { "Content-Type" => "application/json" })
27
+
28
+ result = recipients.add_status(status_id: "10")
29
+ expect(result["isFinished"]).to be true
30
+ end
31
+ end
32
+
33
+ describe "#list" do
34
+ it "lists recipients for a campaign" do
35
+ stub_request(:get, "#{base_url}/recipients/list")
36
+ .with(query: { campaignID: "1" })
37
+ .to_return(status: 200, body: { results: [] }.to_json,
38
+ headers: { "Content-Type" => "application/json" })
39
+
40
+ result = recipients.list(campaign_id: "1")
41
+ expect(result["results"]).to eq([])
42
+ end
43
+
44
+ it "passes filter and pagination params" do
45
+ stub_request(:get, "#{base_url}/recipients/list")
46
+ .with(query: { campaignID: "1", filter: "active", search: "john", perPage: "25" })
47
+ .to_return(status: 200, body: { results: [] }.to_json,
48
+ headers: { "Content-Type" => "application/json" })
49
+
50
+ recipients.list(campaign_id: "1", filter: "active", search: "john", per_page: "25")
51
+ end
52
+ end
53
+
54
+ describe "#get" do
55
+ it "gets a recipient by id" do
56
+ stub_request(:get, "#{base_url}/recipients/get")
57
+ .with(query: { recipientID: "100" })
58
+ .to_return(status: 200, body: { id: 100, emailAddress: "john@example.com" }.to_json,
59
+ headers: { "Content-Type" => "application/json" })
60
+
61
+ result = recipients.get(recipient_id: "100")
62
+ expect(result["emailAddress"]).to eq("john@example.com")
63
+ end
64
+ end
65
+
66
+ describe "#pause" do
67
+ it "pauses a recipient" do
68
+ stub_request(:post, "#{base_url}/recipients/pause")
69
+ .with(body: { campaignID: 1, emailAddress: "john@example.com" }.to_json)
70
+ .to_return(status: 200, body: {}.to_json,
71
+ headers: { "Content-Type" => "application/json" })
72
+
73
+ recipients.pause(campaign_id: 1, email_address: "john@example.com")
74
+ end
75
+ end
76
+
77
+ describe "#unpause" do
78
+ it "unpauses a recipient" do
79
+ stub_request(:post, "#{base_url}/recipients/unpause")
80
+ .with(body: { campaignID: 1, emailAddress: "john@example.com" }.to_json)
81
+ .to_return(status: 200, body: {}.to_json,
82
+ headers: { "Content-Type" => "application/json" })
83
+
84
+ recipients.unpause(campaign_id: 1, email_address: "john@example.com")
85
+ end
86
+ end
87
+
88
+ describe "#unsubscribe" do
89
+ it "unsubscribes email addresses" do
90
+ stub_request(:post, "#{base_url}/recipients/unsubscribe")
91
+ .with(body: { emailAddresses: ["john@example.com"] }.to_json)
92
+ .to_return(status: 200, body: {}.to_json,
93
+ headers: { "Content-Type" => "application/json" })
94
+
95
+ recipients.unsubscribe(email_addresses: ["john@example.com"])
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Mailshake::Senders do
6
+ let(:senders) { described_class.new(Mailshake.client) }
7
+ let(:base_url) { "https://api.mailshake.com/2017-04-01" }
8
+
9
+ describe "#list" do
10
+ it "lists senders" do
11
+ stub_request(:get, "#{base_url}/senders/list")
12
+ .to_return(status: 200, body: { results: [] }.to_json,
13
+ headers: { "Content-Type" => "application/json" })
14
+
15
+ result = senders.list
16
+ expect(result["results"]).to eq([])
17
+ end
18
+
19
+ it "passes search and pagination params" do
20
+ stub_request(:get, "#{base_url}/senders/list")
21
+ .with(query: { search: "sales", perPage: "10" })
22
+ .to_return(status: 200, body: { results: [] }.to_json,
23
+ headers: { "Content-Type" => "application/json" })
24
+
25
+ senders.list(search: "sales", per_page: "10")
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Mailshake::Team do
6
+ let(:team) { described_class.new(Mailshake.client) }
7
+ let(:base_url) { "https://api.mailshake.com/2017-04-01" }
8
+
9
+ describe "#list_members" do
10
+ it "lists team members" do
11
+ stub_request(:get, "#{base_url}/team/list-members")
12
+ .to_return(status: 200, body: { results: [] }.to_json,
13
+ headers: { "Content-Type" => "application/json" })
14
+
15
+ result = team.list_members
16
+ expect(result["results"]).to eq([])
17
+ end
18
+
19
+ it "passes search and pagination params" do
20
+ stub_request(:get, "#{base_url}/team/list-members")
21
+ .with(query: { search: "john", perPage: "10" })
22
+ .to_return(status: 200, body: { results: [] }.to_json,
23
+ headers: { "Content-Type" => "application/json" })
24
+
25
+ team.list_members(search: "john", per_page: "10")
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+ require "mailshake"
5
+ require "webmock/rspec"
6
+ require "base64"
7
+
8
+ RSpec.configure do |config|
9
+ config.expect_with :rspec do |expectations|
10
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
11
+ end
12
+
13
+ config.mock_with :rspec do |mocks|
14
+ mocks.verify_partial_doubles = true
15
+ end
16
+
17
+ config.shared_context_metadata_behavior = :apply_to_host_groups
18
+ config.filter_run_when_matching :focus
19
+ config.example_status_persistence_file_path = "spec/examples.txt"
20
+ config.disable_monkey_patching!
21
+ config.warnings = true
22
+
23
+ if config.files_to_run.one?
24
+ config.default_formatter = "doc"
25
+ end
26
+
27
+ config.order = :random
28
+ Kernel.srand config.seed
29
+
30
+ config.before(:each) do
31
+ WebMock.disable_net_connect!
32
+ Mailshake.reset!
33
+ Mailshake.configure do |c|
34
+ c.api_key = "test_api_key"
35
+ end
36
+ end
37
+
38
+ config.after(:each) do
39
+ WebMock.reset!
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mailshake-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eduardo Souza
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-04-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.21'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.21'
27
+ - !ruby/object:Gem::Dependency
28
+ name: base64
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '13.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '13.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.12'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.12'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.18'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.18'
111
+ description: Ruby gem for integrating with the Mailshake email outreach API. Supports
112
+ campaigns, recipients, activity tracking, leads, team members, senders, and push
113
+ webhooks.
114
+ email:
115
+ - eduardo@eduardosouza.com
116
+ executables: []
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - CHANGELOG.md
121
+ - LICENSE.txt
122
+ - README.md
123
+ - lib/mailshake.rb
124
+ - lib/mailshake/activity.rb
125
+ - lib/mailshake/base.rb
126
+ - lib/mailshake/campaigns.rb
127
+ - lib/mailshake/client.rb
128
+ - lib/mailshake/configuration.rb
129
+ - lib/mailshake/errors.rb
130
+ - lib/mailshake/leads.rb
131
+ - lib/mailshake/push.rb
132
+ - lib/mailshake/recipients.rb
133
+ - lib/mailshake/senders.rb
134
+ - lib/mailshake/team.rb
135
+ - lib/mailshake/version.rb
136
+ - spec/examples.txt
137
+ - spec/mailshake/activity_spec.rb
138
+ - spec/mailshake/campaigns_spec.rb
139
+ - spec/mailshake/client_spec.rb
140
+ - spec/mailshake/configuration_spec.rb
141
+ - spec/mailshake/leads_spec.rb
142
+ - spec/mailshake/push_spec.rb
143
+ - spec/mailshake/recipients_spec.rb
144
+ - spec/mailshake/senders_spec.rb
145
+ - spec/mailshake/team_spec.rb
146
+ - spec/spec_helper.rb
147
+ homepage: https://github.com/esouza/mailshake-ruby
148
+ licenses:
149
+ - MIT
150
+ metadata:
151
+ homepage_uri: https://github.com/esouza/mailshake-ruby
152
+ source_code_uri: https://github.com/esouza/mailshake-ruby
153
+ changelog_uri: https://github.com/esouza/mailshake-ruby/blob/main/CHANGELOG.md
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 2.7.0
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubygems_version: 3.5.21
170
+ signing_key:
171
+ specification_version: 4
172
+ summary: Ruby gem for Mailshake email outreach API integration
173
+ test_files: []