faraday_middleware-emarsys 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +50 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/VERSION +1 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/faraday_middleware-emarsys.gemspec +44 -0
- data/lib/faraday_middleware/emarsys.rb +28 -0
- data/lib/faraday_middleware/emarsys/constants.rb +16 -0
- data/lib/faraday_middleware/emarsys/version.rb +3 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e7870a202a6f93d82453f63ce3410597ccafced1
|
4
|
+
data.tar.gz: 26cd8102bf527762da975876d756660782ffc989
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 48feb86ae4aa4507d7906f26deee93400d1e94fef6b9017a772cdcf025962217ee0946a97f3d36ad31f43b7503024d1c6df238fe6e4b6d6ec7a34ceed45d9d8c
|
7
|
+
data.tar.gz: 01d2d3ad2bb2644d4b70b9f44188fd9c540f9d8aa7c6e1b1e9f574cc409f78bdc9cc3bb76f75d95d52f371f080d7c96d368e400747908fb036b9480381c52176
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at adamluzsi@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
faraday_middleware-emarsys (0.1.0)
|
5
|
+
escher-keypool
|
6
|
+
faraday
|
7
|
+
faraday_middleware-escher
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.5.0)
|
13
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
14
|
+
diff-lcs (1.2.5)
|
15
|
+
escher (0.4.3)
|
16
|
+
addressable (~> 2.3)
|
17
|
+
escher-keypool (0.0.1)
|
18
|
+
faraday (0.10.0)
|
19
|
+
multipart-post (>= 1.2, < 3)
|
20
|
+
faraday_middleware-escher (0.3.4)
|
21
|
+
escher
|
22
|
+
faraday
|
23
|
+
multipart-post (2.0.0)
|
24
|
+
public_suffix (2.0.4)
|
25
|
+
rake (10.5.0)
|
26
|
+
rspec (3.5.0)
|
27
|
+
rspec-core (~> 3.5.0)
|
28
|
+
rspec-expectations (~> 3.5.0)
|
29
|
+
rspec-mocks (~> 3.5.0)
|
30
|
+
rspec-core (3.5.4)
|
31
|
+
rspec-support (~> 3.5.0)
|
32
|
+
rspec-expectations (3.5.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.5.0)
|
35
|
+
rspec-mocks (3.5.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.5.0)
|
38
|
+
rspec-support (3.5.0)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
bundler (~> 1.12)
|
45
|
+
faraday_middleware-emarsys!
|
46
|
+
rake (~> 10.0)
|
47
|
+
rspec (~> 3.0)
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
1.12.5
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# FaradayMiddleware::Emarsys
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/faraday_middleware/emarsys`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'faraday_middleware-emarsys'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install faraday_middleware-emarsys
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/faraday_middleware-emarsys. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "faraday_middleware/emarsys"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'faraday_middleware/emarsys/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
|
8
|
+
spec.name = "faraday_middleware-emarsys"
|
9
|
+
spec.version = FaradayMiddleware::Emarsys::VERSION
|
10
|
+
|
11
|
+
spec.summary = %q{FaradayMiddleware for Emarsys pecifications}
|
12
|
+
spec.description = %q{FaradayMiddleware for Emarsys pecifications}
|
13
|
+
spec.homepage = "https://github.com/emartech/faraday_middleware-emarsys"
|
14
|
+
|
15
|
+
spec.authors = ["Adam Luzsi", "Balint Bejczi", "karoly Bujtor"]
|
16
|
+
spec.email = [
|
17
|
+
"adamluzsi@gmail.com",
|
18
|
+
"aluzsi@emarsys.com",
|
19
|
+
"bbejczi@emarsys.com",
|
20
|
+
"karoly.bujtor@emarsys.com"
|
21
|
+
]
|
22
|
+
|
23
|
+
# # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
24
|
+
# # to allow pushing to a single host or delete this section to allow pushing to any host.
|
25
|
+
# if spec.respond_to?(:metadata)
|
26
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
27
|
+
# else
|
28
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
29
|
+
# end
|
30
|
+
|
31
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
37
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
38
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
39
|
+
|
40
|
+
spec.add_dependency 'faraday'
|
41
|
+
spec.add_dependency 'escher-keypool'
|
42
|
+
spec.add_dependency 'faraday_middleware-escher'
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
module FaradayMiddleware
|
3
|
+
class Emarsys < Faraday::Middleware
|
4
|
+
require 'faraday_middleware/emarsys/version'
|
5
|
+
require 'faraday_middleware/emarsys/constants'
|
6
|
+
|
7
|
+
dependency do
|
8
|
+
require 'json'
|
9
|
+
require 'escher-keypool'
|
10
|
+
require 'faraday_middleware/escher'
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(app, credential_scope:, key_id:)
|
14
|
+
super(app)
|
15
|
+
|
16
|
+
@signer = ::FaradayMiddleware::Escher::RequestSigner.new(
|
17
|
+
@app,
|
18
|
+
credential_scope: credential_scope,
|
19
|
+
options: self.class::ESCHER_OPTIONS,
|
20
|
+
active_key: -> { ::Escher::Keypool.new.get_active_key(key_id) }
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def call(env)
|
25
|
+
@signer.call(env)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'faraday_middleware/emarsys'
|
2
|
+
class FaradayMiddleware::Emarsys
|
3
|
+
CONTENT_TYPE = 'Content-Type'.freeze
|
4
|
+
DEFAULT_MIME_TYPE = 'application/json'.freeze
|
5
|
+
STREAM_MIME_TYPE = 'application/stream+json'.freeze
|
6
|
+
|
7
|
+
ESCHER_OPTIONS = {
|
8
|
+
algo_prefix: 'EMS',
|
9
|
+
vendor_key: 'EMS',
|
10
|
+
auth_header_name: 'X-Ems-Auth',
|
11
|
+
date_header_name: 'X-Ems-Date'
|
12
|
+
}.each do |k, v|
|
13
|
+
k.freeze
|
14
|
+
v.freeze
|
15
|
+
end.freeze
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: faraday_middleware-emarsys
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Luzsi
|
8
|
+
- Balint Bejczi
|
9
|
+
- karoly Bujtor
|
10
|
+
autorequire:
|
11
|
+
bindir: exe
|
12
|
+
cert_chain: []
|
13
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.12'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.12'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '10.0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '10.0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: faraday
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: escher-keypool
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: faraday_middleware-escher
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
description: FaradayMiddleware for Emarsys pecifications
|
100
|
+
email:
|
101
|
+
- adamluzsi@gmail.com
|
102
|
+
- aluzsi@emarsys.com
|
103
|
+
- bbejczi@emarsys.com
|
104
|
+
- karoly.bujtor@emarsys.com
|
105
|
+
executables: []
|
106
|
+
extensions: []
|
107
|
+
extra_rdoc_files: []
|
108
|
+
files:
|
109
|
+
- CODE_OF_CONDUCT.md
|
110
|
+
- Gemfile
|
111
|
+
- Gemfile.lock
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- VERSION
|
115
|
+
- bin/console
|
116
|
+
- bin/setup
|
117
|
+
- faraday_middleware-emarsys.gemspec
|
118
|
+
- lib/faraday_middleware/emarsys.rb
|
119
|
+
- lib/faraday_middleware/emarsys/constants.rb
|
120
|
+
- lib/faraday_middleware/emarsys/version.rb
|
121
|
+
homepage: https://github.com/emartech/faraday_middleware-emarsys
|
122
|
+
licenses: []
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.5.1
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: FaradayMiddleware for Emarsys pecifications
|
144
|
+
test_files: []
|