exact_target 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.infinity_test +9 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Rakefile +15 -0
- data/exact_target.gemspec +22 -0
- data/lib/exact_target.rb +6 -0
- data/lib/exact_target/client.rb +38 -0
- data/lib/exact_target/version.rb +3 -0
- data/spec/exact_target/exact_target_spec.rb +4 -0
- data/spec/exact_target/lib/client_spec.rb +4 -0
- data/spec/quality_spec.rb +11 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/custom_matchers.rb +54 -0
- metadata +99 -0
data/.gitignore
ADDED
data/.infinity_test
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-cfs --tty
|
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
require 'rspec/core'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
Bundler::GemHelper.install_tasks
|
9
|
+
|
10
|
+
desc "Run Specs"
|
11
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
12
|
+
spec.pattern = "spec/**/*_spec.rb"
|
13
|
+
spec.verbose = true
|
14
|
+
spec.rspec_opts = ['--color']
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/exact_target/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Scott Gonyea", "Colman Nady"]
|
6
|
+
gem.email = ["sgonyea@truecar.com"]
|
7
|
+
gem.description = %q{Exact Target S4 ("Enterprise 2.0") API wrapper, using Savon.}
|
8
|
+
gem.summary = %q{Exact Target S4 API wrapper, using Savon.}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "exact_target"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = ExactTarget::VERSION
|
17
|
+
|
18
|
+
gem.add_runtime_dependency('savon', '~> 0.9.7')
|
19
|
+
|
20
|
+
gem.add_development_dependency('yard')
|
21
|
+
gem.add_development_dependency('rspec', '~>2.7.0')
|
22
|
+
end
|
data/lib/exact_target.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module ExactTarget
|
2
|
+
class Client
|
3
|
+
S4_WSDL_Document = "https://webservice.s4.exacttarget.com/etframework.wsdl"
|
4
|
+
|
5
|
+
attr_accessor :username, :password, :client
|
6
|
+
|
7
|
+
def initialize(username, password)
|
8
|
+
self.username = username
|
9
|
+
self.password = password
|
10
|
+
|
11
|
+
self.client = new_client
|
12
|
+
end
|
13
|
+
|
14
|
+
def new_client(wsdl_document=S4_WSDL_Document)
|
15
|
+
client = Savon::Client.new {
|
16
|
+
wsdl.document = wsdl_document
|
17
|
+
wsse.credentials(username, password)
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def system_status_ok?
|
22
|
+
system_status == "OK"
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
def system_status
|
27
|
+
response = client.request(:get_system_status)
|
28
|
+
resp_msg = response.body[:system_status_response_msg]
|
29
|
+
result = resp_msg[:results][:result]
|
30
|
+
result[:system_status]
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_version_info
|
34
|
+
response = client.request(:version_info)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
IGNORE = /\.(gitmodules|gitkeep$|gitignore$|txt$|png$|tar$|gz$|rbc$|gem$|pdf$)/
|
4
|
+
|
5
|
+
describe "The application itself" do
|
6
|
+
it "has no malformed whitespace" do
|
7
|
+
files = `git ls-files`.split("\n").select {|fn| fn !~ IGNORE}
|
8
|
+
|
9
|
+
files.should be_well_formed
|
10
|
+
end
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
Bundler.require :default, :development, :test
|
4
|
+
|
5
|
+
require 'exact_target'
|
6
|
+
|
7
|
+
spec_path = Bundler.root.join("spec")
|
8
|
+
|
9
|
+
# Pull in the support files
|
10
|
+
Dir[ spec_path.join("support/**/*.rb") ].each{|f| require f}
|
11
|
+
|
12
|
+
RSpec.configure do |c|
|
13
|
+
c.include CustomMatchers
|
14
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module CustomMatchers
|
2
|
+
class BeWellFormed
|
3
|
+
attr_writer :errors
|
4
|
+
|
5
|
+
def errors
|
6
|
+
@errors ||= []
|
7
|
+
end
|
8
|
+
|
9
|
+
def matches?(files)
|
10
|
+
self.errors = files.dup
|
11
|
+
|
12
|
+
errors.map! do |filename|
|
13
|
+
file = File.read(filename).encode!("UTF-8")
|
14
|
+
|
15
|
+
next unless file.valid_encoding?
|
16
|
+
|
17
|
+
[ check_for_tabs(filename, file), excessive_spacing(filename, file), newline_precedes_eof(filename, file) ]
|
18
|
+
end
|
19
|
+
|
20
|
+
errors.flatten!
|
21
|
+
errors.compact!
|
22
|
+
|
23
|
+
errors.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
def failure_message_for_should
|
27
|
+
errors.join("\n")
|
28
|
+
end
|
29
|
+
|
30
|
+
def check_for_tabs(filename, file)
|
31
|
+
bad_lines = file.lines.each_with_index.map do |line, line_no|
|
32
|
+
line_no + 1 if line["\t"] and line !~ /^\s+#.*\s+\n$/
|
33
|
+
end.flatten.compact
|
34
|
+
|
35
|
+
"#{filename} has tab characters on lines #{bad_lines.join(', ')}" if bad_lines.any?
|
36
|
+
end
|
37
|
+
|
38
|
+
def excessive_spacing(filename, file)
|
39
|
+
bad_lines = file.lines.each_with_index.map do |line, line_no|
|
40
|
+
line_no + 1 if line =~ /\s+\n$/ and line !~ /^\s+#.*\s+\n$/
|
41
|
+
end.flatten.compact
|
42
|
+
|
43
|
+
"#{filename} has spaces on the EOL on lines #{bad_lines.join(', ')}" if bad_lines.any?
|
44
|
+
end
|
45
|
+
|
46
|
+
def newline_precedes_eof(filename, file)
|
47
|
+
"#{filename} does not have a newline (\\n) before EOF" if file !~ /\n$/
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def be_well_formed
|
52
|
+
BeWellFormed.new
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: exact_target
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Scott Gonyea
|
9
|
+
- Colman Nady
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-12-30 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: savon
|
17
|
+
requirement: &70320376631980 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.7
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70320376631980
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: yard
|
28
|
+
requirement: &70320376630840 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70320376630840
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
requirement: &70320376629660 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.7.0
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70320376629660
|
48
|
+
description: Exact Target S4 ("Enterprise 2.0") API wrapper, using Savon.
|
49
|
+
email:
|
50
|
+
- sgonyea@truecar.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- .infinity_test
|
57
|
+
- .rspec
|
58
|
+
- Gemfile
|
59
|
+
- Rakefile
|
60
|
+
- exact_target.gemspec
|
61
|
+
- lib/exact_target.rb
|
62
|
+
- lib/exact_target/client.rb
|
63
|
+
- lib/exact_target/version.rb
|
64
|
+
- spec/exact_target/exact_target_spec.rb
|
65
|
+
- spec/exact_target/lib/client_spec.rb
|
66
|
+
- spec/quality_spec.rb
|
67
|
+
- spec/spec_helper.rb
|
68
|
+
- spec/support/custom_matchers.rb
|
69
|
+
homepage: ''
|
70
|
+
licenses: []
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.8.12
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Exact Target S4 API wrapper, using Savon.
|
93
|
+
test_files:
|
94
|
+
- spec/exact_target/exact_target_spec.rb
|
95
|
+
- spec/exact_target/lib/client_spec.rb
|
96
|
+
- spec/quality_spec.rb
|
97
|
+
- spec/spec_helper.rb
|
98
|
+
- spec/support/custom_matchers.rb
|
99
|
+
has_rdoc:
|