sendpulse_client 0.1.2 → 0.2.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/sendpulse_client/addressbook.rb +18 -1
- data/lib/sendpulse_client/connection.rb +11 -5
- data/lib/sendpulse_client/email.rb +17 -0
- data/lib/sendpulse_client/version.rb +1 -1
- data/lib/sendpulse_client.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e82b414e6a8cfac4c0d4749483eba963a1bb87
|
4
|
+
data.tar.gz: 1ff6f7f08805f430038a45b3ca57e3fd9983597b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d628519210e3efc8c54ff40b031bb61da149937d2909770eab9ea33ee0fe9746476fd7a1b381f192bc4d4e24a26a042914f80a0a831e9e3101b17122d1dd0da
|
7
|
+
data.tar.gz: 91895d362ca86784440f9ce30a07a0e35ca475fa749a8fdea19a9167af0fd812a2722c461f5daf1fb763df6276e474343788afc1220189d07971c149cf7a28ba
|
data/.gitignore
CHANGED
@@ -10,13 +10,30 @@ module SendpulseClient
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create(name)
|
13
|
-
Connection.post_request(URL,
|
13
|
+
Connection.post_request(URL, bookName: name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def clients(book_id, offset = '', limit = '')
|
17
|
+
params = {
|
18
|
+
offset: offset,
|
19
|
+
limit: limit
|
20
|
+
}
|
21
|
+
|
22
|
+
Connection.get_request("#{URL}/#{book_id}/emails", params)
|
14
23
|
end
|
15
24
|
|
16
25
|
def add_clients(book_id, clients)
|
17
26
|
emails = JSON.generate(clients)
|
18
27
|
Connection.post_request("#{URL}/#{book_id}/emails", emails: emails)
|
19
28
|
end
|
29
|
+
|
30
|
+
def delete_clients(emails)
|
31
|
+
Connection.delete_request("#{URL}/emails", emails: JSON.generate(emails))
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_client(book_id, email)
|
35
|
+
Connection.get_request("#{URL}/#{book_id}/emails/#{email}")
|
36
|
+
end
|
20
37
|
end
|
21
38
|
end
|
22
39
|
end
|
@@ -39,9 +39,7 @@ module SendpulseClient
|
|
39
39
|
headers: auth_headers
|
40
40
|
}
|
41
41
|
|
42
|
-
|
43
|
-
response = get(path, params)
|
44
|
-
puts response.parsed_response
|
42
|
+
get(path, params).parsed_response
|
45
43
|
end
|
46
44
|
|
47
45
|
def post_request(path, data = {})
|
@@ -50,8 +48,16 @@ module SendpulseClient
|
|
50
48
|
headers: auth_headers
|
51
49
|
}
|
52
50
|
|
53
|
-
|
54
|
-
|
51
|
+
post(path, body).parsed_response
|
52
|
+
end
|
53
|
+
|
54
|
+
def delete_request(path, body = {})
|
55
|
+
body = {
|
56
|
+
body: data,
|
57
|
+
headers: auth_headers
|
58
|
+
}
|
59
|
+
|
60
|
+
delete(path, body).parsed_response
|
55
61
|
end
|
56
62
|
|
57
63
|
private
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'sendpulse_client/connection'
|
2
|
+
|
3
|
+
module SendpulseClient
|
4
|
+
class Email
|
5
|
+
URL = '/emails'.freeze
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def get(email)
|
9
|
+
Connection.get_request("#{URL}/#{email}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def delete(email)
|
13
|
+
Connection.delete_request("#{URL}/#{email}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/sendpulse_client.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendpulse_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poctek
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/sendpulse_client/campaign.rb
|
88
88
|
- lib/sendpulse_client/configuration.rb
|
89
89
|
- lib/sendpulse_client/connection.rb
|
90
|
+
- lib/sendpulse_client/email.rb
|
90
91
|
- lib/sendpulse_client/version.rb
|
91
92
|
- sendpulse_client-0.1.0.gem
|
92
93
|
- sendpulse_client.gemspec
|