createsend 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,6 +1,4 @@
1
1
  .DS_Store
2
- config.yaml
3
- config.jdennes.yaml
4
2
  rdoc
5
3
  pkg
6
4
  *.gem
@@ -10,15 +10,17 @@ GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
12
  fakeweb (1.3.0)
13
- hashie (1.0.0)
14
- httparty (0.8.0)
13
+ hashie (1.2.0)
14
+ httparty (0.8.1)
15
15
  multi_json
16
16
  multi_xml
17
17
  jnunemaker-matchy (0.4.0)
18
- json (1.5.1)
19
- mocha (0.9.12)
20
- multi_json (0.0.5)
21
- multi_xml (0.4.0)
18
+ json (1.6.1)
19
+ metaclass (0.0.1)
20
+ mocha (0.10.0)
21
+ metaclass (~> 0.0.1)
22
+ multi_json (1.0.3)
23
+ multi_xml (0.4.1)
22
24
  shoulda (2.11.3)
23
25
 
24
26
  PLATFORMS
@@ -4,13 +4,6 @@ require 'httparty'
4
4
  require 'hashie'
5
5
  Hash.send :include, Hashie::HashExtensions
6
6
 
7
- CreateSendOptions = { 'api_key' => nil, 'base_uri' => "http://api.createsend.com/api/v3" } if not Object.const_defined? :CreateSendOptions # :nodoc:
8
- if File.exists?('config.yaml')
9
- config = YAML.load_file('config.yaml')
10
- CreateSendOptions['base_uri'] = config['base_uri']
11
- CreateSendOptions['api_key'] = config['api_key']
12
- end
13
-
14
7
  libdir = File.dirname(__FILE__)
15
8
  $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
16
9
 
@@ -56,7 +49,7 @@ module CreateSend
56
49
  # Provides high level CreateSend functionality/data you'll probably need.
57
50
  class CreateSend
58
51
  include HTTParty
59
-
52
+
60
53
  class Parser::DealWithCreateSendInvalidJson < HTTParty::Parser
61
54
  # The createsend API returns an ID as a string when a 201 Created
62
55
  # response is returned. Unfortunately this is invalid json.
@@ -69,18 +62,18 @@ module CreateSend
69
62
  end
70
63
  end
71
64
  parser Parser::DealWithCreateSendInvalidJson
72
-
65
+ @@base_uri = "https://api.createsend.com/api/v3"
66
+ @@api_key = ""
73
67
  headers({
74
68
  'User-Agent' => "createsend-ruby-#{CreateSend::VERSION}",
75
69
  'Content-Type' => 'application/json; charset=utf-8',
76
70
  'Accept-Encoding' => 'gzip, deflate' })
77
- base_uri CreateSendOptions['base_uri']
78
- basic_auth CreateSendOptions['api_key'], 'x'
71
+ base_uri @@base_uri
72
+ basic_auth @@api_key, 'x'
79
73
 
80
74
  # Sets the API key which will be used to make calls to the CreateSend API.
81
75
  def self.api_key(api_key=nil)
82
76
  return @@api_key unless api_key
83
- CreateSendOptions['api_key'] = api_key
84
77
  @@api_key = api_key
85
78
  basic_auth @@api_key, 'x'
86
79
  end
@@ -1,3 +1,3 @@
1
1
  module CreateSend
2
- VERSION = "1.0.0" unless defined?(CreateSend::VERSION)
2
+ VERSION = "1.0.1" unless defined?(CreateSend::VERSION)
3
3
  end
@@ -4,7 +4,7 @@ class CreateSendTest < Test::Unit::TestCase
4
4
  context "when an api caller is authenticated" do
5
5
  setup do
6
6
  @api_key = '123123123123123123123'
7
- @base_uri = 'http://api.createsend.com/api/v3'
7
+ @base_uri = 'https://api.createsend.com/api/v3'
8
8
  CreateSend.api_key @api_key
9
9
  @cs = CreateSend::CreateSend.new
10
10
  end
@@ -14,7 +14,7 @@ class CreateSendTest < Test::Unit::TestCase
14
14
  site_url = "http://iamadesigner.createsend.com/"
15
15
  username = "myusername"
16
16
  password = "mypassword"
17
- stub_get(nil, "http://#{username}:#{password}@#{uri.host}#{uri.path}/apikey.json?SiteUrl=#{CGI.escape(site_url)}", "apikey.json")
17
+ stub_get(nil, "https://#{username}:#{password}@#{uri.host}#{uri.path}/apikey.json?SiteUrl=#{CGI.escape(site_url)}", "apikey.json")
18
18
  apikey = @cs.apikey(site_url, username, password).ApiKey
19
19
  apikey.should == "981298u298ue98u219e8u2e98u2"
20
20
  end
@@ -51,7 +51,7 @@ class CreateSendTest < Test::Unit::TestCase
51
51
  context "when the CreateSend API responds with an error" do
52
52
  setup do
53
53
  @api_key = '123123123123123123123'
54
- @base_uri = 'http://api.createsend.com/api/v3'
54
+ @base_uri = 'https://api.createsend.com/api/v3'
55
55
  CreateSend.api_key @api_key
56
56
  @cs = CreateSend::CreateSend.new
57
57
  @template = CreateSend::Template.new(:template_id => '98y2e98y289dh89h938389')
@@ -19,7 +19,7 @@ def fixture_file(filename)
19
19
  end
20
20
 
21
21
  def createsend_url(api_key, url)
22
- api_key.nil? ? url : url =~ /^http/ ? url : "http://#{api_key}:x@api.createsend.com/api/v3/#{url}"
22
+ api_key.nil? ? url : url =~ /^http/ ? url : "https://#{api_key}:x@api.createsend.com/api/v3/#{url}"
23
23
  end
24
24
 
25
25
  def stub_request(method, api_key, url, filename, status=nil)
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: createsend
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 21
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 0
9
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - James Dennes
@@ -14,99 +15,113 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-09-26 00:00:00 +10:00
18
+ date: 2011-10-25 00:00:00 +11:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- prerelease: false
22
- type: :development
23
- name: fakeweb
24
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ none: false
25
24
  requirements:
26
25
  - - ~>
27
26
  - !ruby/object:Gem::Version
27
+ hash: 9
28
28
  segments:
29
29
  - 1
30
30
  - 3
31
31
  version: "1.3"
32
+ type: :development
32
33
  requirement: *id001
33
- - !ruby/object:Gem::Dependency
34
34
  prerelease: false
35
- type: :development
36
- name: jnunemaker-matchy
35
+ name: fakeweb
36
+ - !ruby/object:Gem::Dependency
37
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ none: false
38
39
  requirements:
39
40
  - - ~>
40
41
  - !ruby/object:Gem::Version
42
+ hash: 3
41
43
  segments:
42
44
  - 0
43
45
  - 4
44
46
  version: "0.4"
47
+ type: :development
45
48
  requirement: *id002
46
- - !ruby/object:Gem::Dependency
47
49
  prerelease: false
48
- type: :development
49
- name: mocha
50
+ name: jnunemaker-matchy
51
+ - !ruby/object:Gem::Dependency
50
52
  version_requirements: &id003 !ruby/object:Gem::Requirement
53
+ none: false
51
54
  requirements:
52
55
  - - ~>
53
56
  - !ruby/object:Gem::Version
57
+ hash: 25
54
58
  segments:
55
59
  - 0
56
60
  - 9
57
61
  version: "0.9"
62
+ type: :development
58
63
  requirement: *id003
59
- - !ruby/object:Gem::Dependency
60
64
  prerelease: false
61
- type: :development
62
- name: shoulda
65
+ name: mocha
66
+ - !ruby/object:Gem::Dependency
63
67
  version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
64
69
  requirements:
65
70
  - - ~>
66
71
  - !ruby/object:Gem::Version
72
+ hash: 21
67
73
  segments:
68
74
  - 2
69
75
  - 11
70
76
  version: "2.11"
77
+ type: :development
71
78
  requirement: *id004
72
- - !ruby/object:Gem::Dependency
73
79
  prerelease: false
74
- type: :runtime
75
- name: json
80
+ name: shoulda
81
+ - !ruby/object:Gem::Dependency
76
82
  version_requirements: &id005 !ruby/object:Gem::Requirement
83
+ none: false
77
84
  requirements:
78
85
  - - ">="
79
86
  - !ruby/object:Gem::Version
87
+ hash: 3
80
88
  segments:
81
89
  - 0
82
90
  version: "0"
91
+ type: :runtime
83
92
  requirement: *id005
84
- - !ruby/object:Gem::Dependency
85
93
  prerelease: false
86
- type: :runtime
87
- name: hashie
94
+ name: json
95
+ - !ruby/object:Gem::Dependency
88
96
  version_requirements: &id006 !ruby/object:Gem::Requirement
97
+ none: false
89
98
  requirements:
90
99
  - - ~>
91
100
  - !ruby/object:Gem::Version
101
+ hash: 15
92
102
  segments:
93
103
  - 1
94
104
  - 0
95
105
  version: "1.0"
106
+ type: :runtime
96
107
  requirement: *id006
97
- - !ruby/object:Gem::Dependency
98
108
  prerelease: false
99
- type: :runtime
100
- name: httparty
109
+ name: hashie
110
+ - !ruby/object:Gem::Dependency
101
111
  version_requirements: &id007 !ruby/object:Gem::Requirement
112
+ none: false
102
113
  requirements:
103
114
  - - ~>
104
115
  - !ruby/object:Gem::Version
116
+ hash: 27
105
117
  segments:
106
118
  - 0
107
119
  - 8
108
120
  version: "0.8"
121
+ type: :runtime
109
122
  requirement: *id007
123
+ prerelease: false
124
+ name: httparty
110
125
  description: Implements the complete functionality of the createsend API.
111
126
  email:
112
127
  - jdennes@gmail.com
@@ -123,7 +138,6 @@ files:
123
138
  - LICENSE
124
139
  - README.md
125
140
  - Rakefile
126
- - config.example.yaml
127
141
  - createsend.gemspec
128
142
  - lib/createsend.rb
129
143
  - lib/createsend/campaign.rb
@@ -194,16 +208,20 @@ rdoc_options: []
194
208
  require_paths:
195
209
  - lib
196
210
  required_ruby_version: !ruby/object:Gem::Requirement
211
+ none: false
197
212
  requirements:
198
213
  - - ">="
199
214
  - !ruby/object:Gem::Version
215
+ hash: 3
200
216
  segments:
201
217
  - 0
202
218
  version: "0"
203
219
  required_rubygems_version: !ruby/object:Gem::Requirement
220
+ none: false
204
221
  requirements:
205
222
  - - ">="
206
223
  - !ruby/object:Gem::Version
224
+ hash: 23
207
225
  segments:
208
226
  - 1
209
227
  - 3
@@ -212,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
230
  requirements: []
213
231
 
214
232
  rubyforge_project:
215
- rubygems_version: 1.3.6
233
+ rubygems_version: 1.6.2
216
234
  signing_key:
217
235
  specification_version: 3
218
236
  summary: A library which implements the complete functionality of v3 of the createsend API.
@@ -1,2 +0,0 @@
1
- base_uri: 'http://api.createsend.com/api/v3'
2
- api_key: 'your_api_key'