createsend 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,4 +4,3 @@ rvm:
4
4
  - 1.9.2
5
5
  - 1.9.3
6
6
  - ree
7
- - ruby-head
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- createsend (1.1.1)
4
+ createsend (2.1.0)
5
5
  hashie (~> 1.0)
6
6
  httparty (~> 0.8)
7
7
  json
@@ -12,6 +12,7 @@ GEM
12
12
  activesupport (3.2.8)
13
13
  i18n (~> 0.6)
14
14
  multi_json (~> 1.0)
15
+ cane (2.0.0)
15
16
  fakeweb (1.3.0)
16
17
  hashie (1.2.0)
17
18
  httparty (0.8.1)
@@ -19,7 +20,7 @@ GEM
19
20
  multi_xml
20
21
  i18n (0.6.0)
21
22
  jnunemaker-matchy (0.4.0)
22
- json (1.6.1)
23
+ json (1.7.4)
23
24
  metaclass (0.0.1)
24
25
  mocha (0.10.0)
25
26
  metaclass (~> 0.0.1)
@@ -37,6 +38,7 @@ PLATFORMS
37
38
  ruby
38
39
 
39
40
  DEPENDENCIES
41
+ cane
40
42
  createsend!
41
43
  fakeweb (~> 1.3)
42
44
  jnunemaker-matchy (~> 0.4)
data/Rakefile CHANGED
@@ -3,10 +3,29 @@ require "bundler/version"
3
3
  require "rake/testtask"
4
4
  require "./lib/createsend"
5
5
 
6
+ begin
7
+ if RUBY_VERSION != "1.8.7" # cane not supported on < 1.8.7
8
+ require 'cane/rake_task'
9
+
10
+ desc "Run cane (checks quality metrics)"
11
+ Cane::RakeTask.new(:quality) do |cane|
12
+ cane.abc_glob = '{lib,test}/**/*.rb'
13
+ cane.abc_max = 10
14
+ puts "running cane."
15
+ end
16
+
17
+ task :default => :quality
18
+ end
19
+ rescue LoadError
20
+ warn "cane not available, quality task not provided."
21
+ end
22
+
23
+ desc "Run tests"
6
24
  Rake::TestTask.new(:test) do |test|
7
25
  test.ruby_opts = ["-rubygems"] if defined? Gem
8
26
  test.libs << "lib" << "test"
9
27
  test.pattern = "test/**/*_test.rb"
28
+ puts "running tests."
10
29
  end
11
30
 
12
31
  desc "Build the gem"
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.add_development_dependency('jnunemaker-matchy', '~> 0.4')
10
10
  s.add_development_dependency('mocha', '~> 0.9')
11
11
  s.add_development_dependency('shoulda', '~> 3.1.1')
12
+ s.add_development_dependency('cane')
12
13
  s.add_runtime_dependency('json')
13
14
  s.add_runtime_dependency('hashie', '~> 1.0')
14
15
  s.add_runtime_dependency('httparty', '~> 0.8')
@@ -18,7 +19,7 @@ Gem::Specification.new do |s|
18
19
  s.email = ["jdennes@gmail.com"]
19
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
20
21
  s.files = `git ls-files`.split("\n")
21
- s.homepage = "http://github.com/campaignmonitor/createsend-ruby/"
22
+ s.homepage = "http://campaignmonitor.github.com/createsend-ruby/"
22
23
  s.require_paths = ["lib"]
23
24
  s.summary = %q{A library which implements the complete functionality of v3 of the createsend API.}
24
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -124,11 +124,14 @@ module CreateSend
124
124
  end
125
125
 
126
126
  # Sets the monthly billing settings for this client.
127
- def set_monthly_billing(currency, client_pays, markup_percentage)
127
+ # monthly_scheme must be nil, Basic or Unlimited
128
+ def set_monthly_billing(currency, client_pays, markup_percentage,
129
+ monthly_scheme = nil)
128
130
  options = { :body => {
129
131
  :Currency => currency,
130
132
  :ClientPays => client_pays,
131
- :MarkupPercentage => markup_percentage }.to_json }
133
+ :MarkupPercentage => markup_percentage,
134
+ :MonthlyScheme => monthly_scheme }.to_json }
132
135
  put 'setmonthlybilling', options
133
136
  end
134
137
 
@@ -1,3 +1,3 @@
1
1
  module CreateSend
2
- VERSION = "2.0.0" unless defined?(CreateSend::VERSION)
2
+ VERSION = "2.1.0" unless defined?(CreateSend::VERSION)
3
3
  end
@@ -23,6 +23,7 @@ class ClientTest < Test::Unit::TestCase
23
23
  cl.BasicDetails.ContactName.should == "Client One (contact)"
24
24
  cl.AccessDetails.Username.should == "clientone"
25
25
  cl.AccessDetails.AccessLevel.should == 23
26
+ cl.BillingDetails.MonthlyScheme.should == "Basic"
26
27
  end
27
28
 
28
29
  should "get all campaigns" do
@@ -146,12 +147,28 @@ class ClientTest < Test::Unit::TestCase
146
147
  stub_put(@api_key, "clients/#{@client.client_id}/setpaygbilling.json", nil)
147
148
  @client.set_payg_billing "CAD", true, true, 150
148
149
  end
149
-
150
- should "set monthly billing" do
150
+
151
+ should "set monthly billing (implicit)" do
151
152
  stub_put(@api_key, "clients/#{@client.client_id}/setmonthlybilling.json", nil)
152
- @client.set_monthly_billing "CAD", true, 150
153
+ @client.set_monthly_billing "CAD", true, 150
154
+ request = FakeWeb.last_request.body
155
+ assert_equal("{\"Currency\":\"CAD\",\"ClientPays\":true,\"MarkupPercentage\":150,\"MonthlyScheme\":null}", request, "Request wasn't as expected")
153
156
  end
154
157
 
158
+ should "set monthly billing (basic)" do
159
+ stub_put(@api_key, "clients/#{@client.client_id}/setmonthlybilling.json", nil)
160
+ @client.set_monthly_billing "CAD", true, 150, "Basic"
161
+ request = FakeWeb.last_request.body
162
+ assert_equal("{\"Currency\":\"CAD\",\"ClientPays\":true,\"MarkupPercentage\":150,\"MonthlyScheme\":\"Basic\"}", request, "Request wasn't as expected")
163
+ end
164
+
165
+ should "set monthly billing (unlimited)" do
166
+ stub_put(@api_key, "clients/#{@client.client_id}/setmonthlybilling.json", nil)
167
+ @client.set_monthly_billing "CAD", false, 120, "Unlimited"
168
+ request = FakeWeb.last_request.body
169
+ assert_equal("{\"Currency\":\"CAD\",\"ClientPays\":false,\"MarkupPercentage\":120,\"MonthlyScheme\":\"Unlimited\"}", request, "Request wasn't as expected")
170
+ end
171
+
155
172
  should "delete a client" do
156
173
  stub_delete(@api_key, "clients/#{@client.client_id}.json", nil)
157
174
  @client.delete
@@ -21,6 +21,7 @@
21
21
  "MarkupOnDelivery": 0.0,
22
22
  "BaseDeliveryRate": 5.0,
23
23
  "Currency": "USD",
24
- "BaseDesignSpamTestRate": 5.0
24
+ "BaseDesignSpamTestRate": 5.0,
25
+ "MonthlyScheme": "Basic"
25
26
  }
26
27
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: createsend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
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-08-22 00:00:00.000000000 Z
12
+ date: 2012-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70279968073360 !ruby/object:Gem::Requirement
16
+ requirement: &70108177254420 !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: *70279968073360
24
+ version_requirements: *70108177254420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fakeweb
27
- requirement: &70279968072660 !ruby/object:Gem::Requirement
27
+ requirement: &70108177253700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.3'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70279968072660
35
+ version_requirements: *70108177253700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jnunemaker-matchy
38
- requirement: &70279968072160 !ruby/object:Gem::Requirement
38
+ requirement: &70108177252980 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.4'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70279968072160
46
+ version_requirements: *70108177252980
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mocha
49
- requirement: &70279968071620 !ruby/object:Gem::Requirement
49
+ requirement: &70108177249420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.9'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70279968071620
57
+ version_requirements: *70108177249420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: shoulda
60
- requirement: &70279968070900 !ruby/object:Gem::Requirement
60
+ requirement: &70108177248920 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: 3.1.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70279968070900
68
+ version_requirements: *70108177248920
69
+ - !ruby/object:Gem::Dependency
70
+ name: cane
71
+ requirement: &70108177248500 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70108177248500
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: json
71
- requirement: &70279968070360 !ruby/object:Gem::Requirement
82
+ requirement: &70108177248020 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *70279968070360
90
+ version_requirements: *70108177248020
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: hashie
82
- requirement: &70279968069500 !ruby/object:Gem::Requirement
93
+ requirement: &70108177247440 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '1.0'
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *70279968069500
101
+ version_requirements: *70108177247440
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: httparty
93
- requirement: &70279968068780 !ruby/object:Gem::Requirement
104
+ requirement: &70108177246860 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,7 +109,7 @@ dependencies:
98
109
  version: '0.8'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *70279968068780
112
+ version_requirements: *70108177246860
102
113
  description: Implements the complete functionality of the createsend API.
103
114
  email:
104
115
  - jdennes@gmail.com
@@ -189,7 +200,7 @@ files:
189
200
  - test/segment_test.rb
190
201
  - test/subscriber_test.rb
191
202
  - test/template_test.rb
192
- homepage: http://github.com/campaignmonitor/createsend-ruby/
203
+ homepage: http://campaignmonitor.github.com/createsend-ruby/
193
204
  licenses: []
194
205
  post_install_message:
195
206
  rdoc_options: []