sendpulse_client 0.1.2 → 0.2.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
2
  SHA1:
3
- metadata.gz: 2bb3936c01310637f2a157f8b94cf366db56fde4
4
- data.tar.gz: 46ec6fbceeaf697598484914303440d0e3fec1a5
3
+ metadata.gz: b9e82b414e6a8cfac4c0d4749483eba963a1bb87
4
+ data.tar.gz: 1ff6f7f08805f430038a45b3ca57e3fd9983597b
5
5
  SHA512:
6
- metadata.gz: c02bd94bf8179f81e0658f053989085219691143a71f0981d73e662564812e741a1803068e13f446296222134bba242896c7cb9694c6d0d045906af50030f6f0
7
- data.tar.gz: fc214da5f3a9b4f4ac1d0fdf272c86a1884baaf7fb682ebcc4adbbcbd1d93826890a49180c8e6a68e61f8e7b2fc1ab505b652e2fe5d0ddcc4ce12172bc70854a
6
+ metadata.gz: 6d628519210e3efc8c54ff40b031bb61da149937d2909770eab9ea33ee0fe9746476fd7a1b381f192bc4d4e24a26a042914f80a0a831e9e3101b17122d1dd0da
7
+ data.tar.gz: 91895d362ca86784440f9ce30a07a0e35ca475fa749a8fdea19a9167af0fd812a2722c461f5daf1fb763df6276e474343788afc1220189d07971c149cf7a28ba
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  .env.development
11
11
  .env.test
12
+ *.gem
@@ -10,13 +10,30 @@ module SendpulseClient
10
10
  end
11
11
 
12
12
  def create(name)
13
- Connection.post_request(URL, 'bookName' => name)
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
- puts token
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
- response = post(path, body)
54
- puts response.parsed_response
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
@@ -1,3 +1,3 @@
1
1
  module SendpulseClient
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -4,6 +4,7 @@ require 'sendpulse_client/connection'
4
4
  require 'sendpulse_client/campaign'
5
5
  require 'sendpulse_client/addressbook'
6
6
  require 'sendpulse_client/configuration'
7
+ require 'sendpulse_client/email'
7
8
 
8
9
  module SendpulseClient
9
10
  end
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.1.2
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