createsend 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -102,10 +102,9 @@ class Client
102
102
  end
103
103
 
104
104
  # Sets the monthly billing settings for this client.
105
- def set_monthly_billing(currency, can_purchase_credits, client_pays, markup_percentage)
105
+ def set_monthly_billing(currency, client_pays, markup_percentage)
106
106
  options = { :body => {
107
107
  :Currency => currency,
108
- :CanPurchaseCredits => can_purchase_credits,
109
108
  :ClientPays => client_pays,
110
109
  :MarkupPercentage => markup_percentage }.to_json }
111
110
  put 'setmonthlybilling', options
@@ -35,7 +35,7 @@ end
35
35
  class ClientError < StandardError; end
36
36
  class ServerError < StandardError; end
37
37
  class BadRequest < CreateSendError; end
38
- class Unauthorized < ClientError; end
38
+ class Unauthorized < CreateSendError; end
39
39
  class NotFound < ClientError; end
40
40
  class Unavailable < StandardError; end
41
41
 
@@ -43,7 +43,7 @@ class Unavailable < StandardError; end
43
43
  class CreateSend
44
44
  include HTTParty
45
45
 
46
- VER = "0.0.2" unless defined?(CreateSend::VER)
46
+ VER = "0.1.0" unless defined?(CreateSend::VER)
47
47
  headers({ 'User-Agent' => "createsend-ruby-#{CreateSend::VER}", 'Content-Type' => 'application/json' })
48
48
  base_uri CreateSendOptions['base_uri']
49
49
  basic_auth CreateSendOptions['api_key'], 'x'
@@ -100,7 +100,7 @@ class CreateSend
100
100
  when 400
101
101
  raise BadRequest.new(Hashie::Mash.new response)
102
102
  when 401
103
- raise Unauthorized.new
103
+ raise Unauthorized.new(Hashie::Mash.new response)
104
104
  when 404
105
105
  raise NotFound.new
106
106
  when 400...500
@@ -105,7 +105,7 @@ class ClientTest < Test::Unit::TestCase
105
105
 
106
106
  should "set monthly billing" do
107
107
  stub_put(@api_key, "clients/#{@client.client_id}/setmonthlybilling.json", nil)
108
- @client.set_monthly_billing "CAD", true, true, 150
108
+ @client.set_monthly_billing "CAD", true, 150
109
109
  end
110
110
 
111
111
  should "delete a client" do
@@ -64,14 +64,14 @@ class CreateSendTest < Test::Unit::TestCase
64
64
  }.each do |status, exception|
65
65
  context "#{status.first}, a get" do
66
66
  should "raise a #{exception.name} error" do
67
- stub_get(@api_key, "countries.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
67
+ stub_get(@api_key, "countries.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
68
68
  lambda { c = @cs.countries }.should raise_error(exception)
69
69
  end
70
70
  end
71
71
 
72
72
  context "#{status.first}, a post" do
73
73
  should "raise a #{exception.name} error" do
74
- stub_post(@api_key, "clients.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
74
+ stub_post(@api_key, "clients.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
75
75
  lambda { Client.create "Client Company Name", "Client Contact Name", "client@example.com",
76
76
  "(GMT+10:00) Canberra, Melbourne, Sydney", "Australia" }.should raise_error(exception)
77
77
  end
@@ -79,7 +79,7 @@ class CreateSendTest < Test::Unit::TestCase
79
79
 
80
80
  context "#{status.first}, a put" do
81
81
  should "raise a #{exception.name} error" do
82
- stub_put(@api_key, "templates/#{@template.template_id}.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
82
+ stub_put(@api_key, "templates/#{@template.template_id}.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
83
83
  lambda { @template.update "Template One Updated", "http://templates.org/index.html",
84
84
  "http://templates.org/files.zip", "http://templates.org/screenshot.jpg" }.should raise_error(exception)
85
85
  end
@@ -87,7 +87,7 @@ class CreateSendTest < Test::Unit::TestCase
87
87
 
88
88
  context "#{status.first}, a delete" do
89
89
  should "raise a #{exception.name} error" do
90
- stub_delete(@api_key, "templates/#{@template.template_id}.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
90
+ stub_delete(@api_key, "templates/#{@template.template_id}.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
91
91
  lambda { @template.delete }.should raise_error(exception)
92
92
  end
93
93
  end
@@ -2,7 +2,6 @@
2
2
  "Results": [
3
3
  {
4
4
  "EmailAddress": "subs+6576576576@example.com",
5
- "URL": "http://video.google.com.au/?hl=en&tab=wv",
6
5
  "ListID": "512a3bc577a58fdf689c654329b50fa0",
7
6
  "Date": "2010-10-11 08:29:00",
8
7
  "IPAddress": "192.168.126.87"
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Dennes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-17 00:00:00 +11:00
18
+ date: 2010-11-25 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency