benchmark_email_api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e85f43b789596a2bbf80c76eb277fdd6f22d1cc1
4
+ data.tar.gz: ac827b50097bd804c229616cc2de488d8834f5e8
5
+ SHA512:
6
+ metadata.gz: 4b1acf25e965a8e20fec581869499e94a6bbb3e5c95b5267ec975c42e8cdfc5443776fe0366b9cb8d0a1f317e7f30f05bf6e4feac812c7987d7a84a27adbe626
7
+ data.tar.gz: e7588a8bbba08b45af0fa8ff48bcee2a5cb3414c50260cf504c2449836e31d9fc047dda883afc72cbf0661294035d21f84e38ce843cff28a6937b5ec1cfc3a8b
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in benchmark_email_api.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 resj
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,58 @@
1
+ # BenchmarkEmailApi
2
+
3
+ This is a Gem built to use the ruby wrapper for Benchmark Email marketing. It has two main methods: one method creates a client object using the Benchmark credentials, the other is a method_missing. The methods you can call are documented in Benchmark's API docs.
4
+
5
+ [http://www.benchmarkemail.com/API/Library]
6
+
7
+ The parameters are the same minus the token ( always the first one to be passed according to the docs) because the client object already has it.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'benchmark_email_api'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install benchmark_email_api
24
+
25
+ ## Usage
26
+
27
+ ## Instantiate a **Client** object.
28
+
29
+ ```ruby
30
+ BMEApi = BenchmarkEmialApi::Client.new(username,password, api_url)
31
+ ```
32
+
33
+
34
+ The Api Url is usually a constant: *'http://api.benchmarkemail.com/1.0/'*.
35
+
36
+ All parameters for the client instantiation are **strings**.
37
+
38
+ ## Call the methods on the api docs.
39
+
40
+ ```ruby
41
+ BMEApi.listsGet
42
+ ```
43
+
44
+ This is a lists method that will be sent to the Benchmark Api throught the Client.
45
+
46
+ ```ruby
47
+ BMEApi.batchAddContacts(list_id, contacts)
48
+ ```
49
+
50
+ Notice how we didn't need to pass the token as the docs suggested: [http://www.benchmarkemail.com/API/Doc/batchAddContacts]
51
+
52
+ ## Contributing
53
+
54
+ 1. Fork it ( https://github.com/[my-github-username]/benchmark_email_api/fork )
55
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
56
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
57
+ 4. Push to the branch (`git push origin my-new-feature`)
58
+ 5. Create a new Pull Request
@@ -0,0 +1,3 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Dir.glob('tasks/**/*.rake').each(&method(:import))
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'benchmark_email_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "benchmark_email_api"
8
+ spec.version = BenchmarkEmailApi::VERSION
9
+ spec.authors = ["resj"]
10
+ spec.email = ["raymons17@gmail.com"]
11
+ spec.summary = ['Deal with the Benchmark email api.']
12
+ spec.description = ['Methods to access the benchmark API over XML RPC.']
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,24 @@
1
+ # require "benchmark_email_api/version"
2
+ require "net/http"
3
+ require "net/https"
4
+ require "openssl"
5
+ require "xmlrpc/client"
6
+
7
+ module BenchmarkEmailApi
8
+ class Client
9
+ def initialize(username,password,api_url)
10
+ @server = XMLRPC::Client.new2(api_url)
11
+ $ok, result = @server.call2('login', username, password)
12
+ if $ok
13
+ @token = result
14
+ else
15
+ puts "Error Code: #{result.faultCode}"
16
+ puts "Error Description: #{result.faultString}"
17
+ end
18
+ end
19
+ def method_missing(api_method, *args)
20
+ $ok, result = @server.call2(api_method.to_s, @token, *args)
21
+ return result
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module BenchmarkEmailApi
2
+ VERSION = "0.0.1"
3
+ end
Binary file
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe BenchmarkEmailApi do
4
+
5
+ it 'makes a connection with the api' do
6
+ bm = BenchmarkEmailApi.new(username,password,apikey)
7
+ expect(bm.token).to eq (true)
8
+ end
9
+ end
@@ -0,0 +1 @@
1
+ require 'benchmark_email_api'
Binary file
@@ -0,0 +1,3 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: benchmark_email_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - resj
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: '["Methods to access the benchmark API over XML RPC."]'
56
+ email:
57
+ - raymons17@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - benchmark_email_api.gemspec
68
+ - lib/benchmark_email_api.rb
69
+ - lib/benchmark_email_api/version.rb
70
+ - spec/.DS_Store
71
+ - spec/benchmark_email_api_spec.rb
72
+ - spec/spec_helper.rb
73
+ - spec/tasks/.DS_Store
74
+ - spec/tasks/rspec.rake
75
+ homepage: ''
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.4.6
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: '["Deal with the Benchmark email api."]'
99
+ test_files:
100
+ - spec/.DS_Store
101
+ - spec/benchmark_email_api_spec.rb
102
+ - spec/spec_helper.rb
103
+ - spec/tasks/.DS_Store
104
+ - spec/tasks/rspec.rake