chimp 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/chimp.gemspec +2 -2
  2. data/lib/chimp.rb +5 -0
  3. data/test/chimp.rb +26 -0
  4. metadata +7 -7
@@ -1,11 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "chimp"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
  s.summary = "Lightweight mailchimp client"
5
5
  s.description = "For those who want something nimble."
6
6
  s.authors = ["Cyril David"]
7
7
  s.email = ["me@cyrildavid.com"]
8
- s.homepage = "http://github.com/cyx/chimp"
8
+ s.homepage = "http://cyx.github.com/chimp"
9
9
 
10
10
  s.files = Dir[
11
11
  "LICENSE",
@@ -34,7 +34,12 @@ class Chimp
34
34
  post("listUnsubscribe", email_address: email, id: list_id)
35
35
  end
36
36
 
37
+ def list_members(list_id, status=nil, opts = {})
38
+ JSON(post("listMembers", id: list_id, status: status))
39
+ end
40
+
37
41
  private
42
+
38
43
  def post(method, dict = {})
39
44
  options = '-X POST --data "%s"' % payload(dict)
40
45
 
@@ -46,4 +46,30 @@ scope do
46
46
 
47
47
  assert_equal curl, $curl
48
48
  end
49
+
50
+ test "list subscribed members" do |chimp|
51
+ $curl_result = JSON.dump({ id: "12345" })
52
+
53
+ result = chimp.list_members("654321")
54
+
55
+ assert_equal({ "id" => "12345" }, result)
56
+
57
+ curl = 'curl -X POST --data "apikey=key-us1&id=654321' +
58
+ '&status=" https://us1.api.mailchimp.com/1.3/?method=listMembers'
59
+
60
+ assert_equal curl, $curl
61
+ end
62
+
63
+ test "list unsubscribed members" do |chimp|
64
+ $curl_result = JSON.dump({ id: "12345" })
65
+
66
+ result = chimp.list_members("654321", "unsubscribed")
67
+
68
+ assert_equal({ "id" => "12345" }, result)
69
+
70
+ curl = 'curl -X POST --data "apikey=key-us1&id=654321' +
71
+ '&status=unsubscribed" https://us1.api.mailchimp.com/1.3/?method=listMembers'
72
+
73
+ assert_equal curl, $curl
74
+ end
49
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chimp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-08 00:00:00.000000000 Z
12
+ date: 2012-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dep
16
- requirement: &70359437590520 !ruby/object:Gem::Requirement
16
+ requirement: &70271583719260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70359437590520
24
+ version_requirements: *70271583719260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: cutest
27
- requirement: &70359437590040 !ruby/object:Gem::Requirement
27
+ requirement: &70271583718780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70359437590040
35
+ version_requirements: *70271583718780
36
36
  description: For those who want something nimble.
37
37
  email:
38
38
  - me@cyrildavid.com
@@ -45,7 +45,7 @@ files:
45
45
  - lib/chimp.rb
46
46
  - chimp.gemspec
47
47
  - test/chimp.rb
48
- homepage: http://github.com/cyx/chimp
48
+ homepage: http://cyx.github.com/chimp
49
49
  licenses: []
50
50
  post_install_message:
51
51
  rdoc_options: []