eventum 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: a1b7ac7e46a8c364b0df44805e15d3c02a92d87a
4
+ data.tar.gz: d394c6b6b276fe2116c8fc1628d0b12afe34f121
5
+ SHA512:
6
+ metadata.gz: 0506204373053667a09434be2fcd3bbf4226926635962551c8a69b36f0301add790f1442c2cbc6ae4b002af9b1c6ff2d2052f50ab0c81fde391ae102ee2c1adb
7
+ data.tar.gz: 4b18a98c73684674c170cd5f3ddcb029981df8f7eb1bfefd64cc52987a18e0e582ee6692fa386a952fffe59d9a6b0bef3f4774d943f06adffdd1c1c669f8dac1
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .ruby-version
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ config_file: .rubocop.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,35 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - Guardfile
6
+
7
+ Style/AlignHash:
8
+ Enabled: true
9
+ EnforcedHashRocketStyle: table
10
+ EnforcedColonStyle: table
11
+
12
+ Style/CollectionMethods:
13
+ Enabled: true
14
+
15
+ Style/CommentAnnotation:
16
+ Enabled: false
17
+
18
+ Style/Documentation:
19
+ Enabled: false
20
+
21
+ Style/MethodCalledOnDoEndBlock:
22
+ Enabled: true
23
+
24
+ Style/OptionHash:
25
+ Enabled: true
26
+
27
+ Style/SingleLineBlockParams:
28
+ Enabled: false
29
+
30
+ Style/StringLiterals:
31
+ Enabled: true
32
+ EnforcedStyle: double_quotes
33
+
34
+ Style/SymbolArray:
35
+ Enabled: true
@@ -0,0 +1,19 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ rvm:
5
+ - 2.0.0
6
+ - 2.1
7
+ - 2.2
8
+ - ruby-head
9
+ - jruby-head
10
+ before_install: gem install bundler -v 1.10.6
11
+ matrix:
12
+ fast_finish: true
13
+ allow_failures:
14
+ - rvm: ruby-head
15
+ - rvm: jruby-head
16
+ install:
17
+ - bundle install --retry=3
18
+ script:
19
+ - bundle exec rake ci
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## master (unreleased)
4
+
5
+ ### New Features
6
+
7
+ ### Changes
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ [@enriikke]: https://github.com/Enriikke
@@ -0,0 +1,35 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people
4
+ who contribute through reporting issues, posting feature requests, updating
5
+ documentation, submitting pull requests or patches, and other activities.
6
+
7
+ We are committed to making participation in this project a harassment-free
8
+ experience for everyone, regardless of level of experience, gender, gender
9
+ identity and expression, sexual orientation, disability, personal appearance,
10
+ body size, race, ethnicity, age, or religion.
11
+
12
+ Examples of unacceptable behavior by participants include the use of sexual
13
+ language or imagery, derogatory comments or personal attacks, trolling, public
14
+ or private harassment, insults, or other unprofessional conduct.
15
+
16
+ Project maintainers have the right and responsibility to remove, edit, or
17
+ reject comments, commits, code, wiki edits, issues, and other contributions that
18
+ are not aligned to this Code of Conduct. Project maintainers who do not follow
19
+ the Code of Conduct may be removed from the project team.
20
+
21
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
22
+ reported by opening an issue or contacting one or more of the project
23
+ maintainers.
24
+
25
+ This Code of Conduct is adapted from the [Contributor Covenant][contcov],
26
+ version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/][contcovver]
27
+
28
+ ---
29
+
30
+ <p align="center">
31
+ <img src="logos/skookum_mark_black.png" alt="Skookum" width="100" />
32
+ </p>
33
+
34
+ [contcov]: http://contributor-covenant.org
35
+ [contcovver]: http://contributor-covenant.org/version/1/0/0/
@@ -0,0 +1,120 @@
1
+ # Contributing
2
+
3
+ Contributions are always welcome! Bug reports and pull requests can be submitted
4
+ on GitHub under the [Eventum repo][repo]. This project is intended to be a safe,
5
+ welcoming space for collaboration, and contributors are expected to adhere to
6
+ the [code of conduct][conduct]. Please follow the guidelines below when
7
+ contributing to Eventum.
8
+
9
+ ## Reporting Issues
10
+
11
+ * Make sure the issue has not already been reported.
12
+ * Check that the issue has not already been fixed in `master`.
13
+ * Open a [new issue][newissue] with a clear and concise description of the
14
+ problem.
15
+ * Include any relevant code or error output in the issue summary.
16
+
17
+ ## Development
18
+
19
+ **Fork** the repo and clone it locally, then install dependencies by running:
20
+
21
+ $ bin/setup
22
+
23
+ Run the test suite to make sure everything is passing:
24
+
25
+ $ bundle exec rspec
26
+
27
+ You can start a Pry session by running:
28
+
29
+ $ bin/console
30
+
31
+ To install this gem onto your local machine run:
32
+
33
+ $ bundle exec rake install
34
+
35
+ ## Pull Request
36
+
37
+ * Create a new branch for your feature/bug.
38
+ * Get coding!
39
+ * Write good tests. See [Testing][testing].
40
+ * Follow the same coding conventions as the rest of the project. See [Coding
41
+ Style][codingstyle].
42
+ * Squash related commits when needed and write good commit messages.
43
+ * Add an entry to the [Changelog][changelog] accordingly. See [Changelog Entries]
44
+ [changelogentries].
45
+ * Make sure the test suite is passing and that there are no style violations
46
+ before pushing your code.
47
+ * Pull requests should be related to a single subject.
48
+ * Open a pull request until you are happy with your contribution and it's ready
49
+ for review.
50
+
51
+ ### Testing
52
+
53
+ Always include tests with you code. Eventum uses [RSpec][rspec] for testing. We
54
+ like to follow the recommendations listed in [Better Specs][betterspecs].
55
+
56
+ Run the entire test suite:
57
+
58
+ $ bundle exec rspec
59
+
60
+ Or run specific files/directories:
61
+
62
+ $ bundle exec rspec spec/lib/eventum_spec.rb
63
+
64
+ Alternatively, the `Gemfile` includes [Guard][guard], a file watcher that will
65
+ automatically run `rspec` when a file is saved. This is not a requirement but we
66
+ encourage running `bundle exec guard` before starting development so that you
67
+ are able to catch failed tests as you code away :-).
68
+
69
+ ### Coding Style
70
+
71
+ Eventum leverages [Hound][hound] to maintain the code style consistent across
72
+ the gem. Hound uses [rubocop][rubocop], which you can run locally.
73
+
74
+ Run for the entire codebase:
75
+
76
+ $ bundle exec rubocop
77
+
78
+ Or run for specific files/directories:
79
+
80
+ $ bundle exec rubocop lib/eventum.rb
81
+
82
+ Just like with tests, `guard` will automatically run `rubocop` when a file is
83
+ saved (unless a test fails). Once again, we would like to encourage running
84
+ `bundle exec guard` before starting development.
85
+
86
+ Hound will comment on pull requests with style violations, and pull requests
87
+ won't be merged until violations are corrected.
88
+
89
+ ### Changelog Entries
90
+
91
+ * Use [Markdown syntax][markdown].
92
+ * The entry line should start with a bullet point `*`.
93
+ * If the change has a related GitHub issue, include a link to it.
94
+ * Provide a brief summary of the change.
95
+ * At the end of the entry, add an implicit link to your GitHub user page as
96
+ `([@username][])`.
97
+ * If this is your first contribution, add a link definition for the implicit
98
+ link to the bottom of the changelog as `[@username]:
99
+ https://github.com/username`.
100
+ * Check the [Changelog][changelog] for examples of good entries.
101
+
102
+ ---
103
+
104
+ <p align="center">
105
+ <img src="logos/skookum_mark_black.png" alt="Skookum" width="100" />
106
+ </p>
107
+
108
+ [repo]: https://github.com/Skookum/eventum
109
+ [conduct]: CODE_OF_CONDUCT.md
110
+ [newissue]: https://github.com/Skookum/eventum/issues/new
111
+ [testing]: #testing
112
+ [codingstyle]: #coding-style
113
+ [changelog]: CHANGELOG.md
114
+ [changelogentries]: #changelog-entries
115
+ [rspec]: https://github.com/rspec/rspec
116
+ [betterspecs]: http://betterspecs.org
117
+ [guard]: https://github.com/guard/guard
118
+ [hound]: https://houndci.com
119
+ [rubocop]: https://github.com/bbatsov/rubocop
120
+ [markdown]: http://daringfireball.net/projects/markdown/syntax
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ group :test do
5
+ gem "coveralls", require: false
6
+ gem "simplecov", require: false
7
+ end
8
+
9
+ group :development, :test do
10
+ gem "pry-byebug"
11
+ gem "guard"
12
+ gem "guard-rspec", require: false
13
+ gem "guard-rubocop", require: false
14
+ gem "rubocop", require: false
15
+ gem "rubocop-rspec", require: false
16
+ end
@@ -0,0 +1,21 @@
1
+ group :tdd, halt_on_fail: true do
2
+ guard :rspec, cmd: "bundle exec rspec" do
3
+ require "guard/rspec/dsl"
4
+ dsl = Guard::RSpec::Dsl.new(self)
5
+
6
+ # RSpec files
7
+ rspec = dsl.rspec
8
+ watch(rspec.spec_helper) { rspec.spec_dir }
9
+ watch(rspec.spec_support) { rspec.spec_dir }
10
+ watch(rspec.spec_files)
11
+
12
+ # Ruby files
13
+ ruby = dsl.ruby
14
+ dsl.watch_spec_files_for(ruby.lib_files)
15
+ end
16
+
17
+ guard :rubocop, all_on_start: false, cmd: "rubocop --require rubocop-rspec" do
18
+ watch(%r{.+\.rb$}) { |m| m[0] }
19
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Enrique Gonzalez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,75 @@
1
+ [![Gem Version](https://img.shields.io/gem/v/eventum.svg)][rubygems]
2
+ [![Build Status](https://img.shields.io/travis/Skookum/eventum.svg)][travis]
3
+ [![Code Climate](https://img.shields.io/codeclimate/github/Skookum/eventum.svg)][codeclimate]
4
+ [![Coverage Status](https://img.shields.io/coveralls/Skookum/eventum.svg)][coveralls]
5
+ [![Inline Docs](http://inch-ci.org/github/Skookum/eventum.svg?style=shields)][inchdocs]
6
+
7
+ [rubygems]: https://rubygems.org/gems/eventum
8
+ [travis]: https://travis-ci.org/Skookum/eventum
9
+ [codeclimate]: https://codeclimate.com/github/Skookum/eventum
10
+ [coveralls]: https://coveralls.io/r/Skookum/eventum
11
+ [inchdocs]: http://inch-ci.org/github/Skookum/eventum
12
+
13
+ ---
14
+
15
+ # Eventum
16
+
17
+ A Ruby wrapper for the [Event Store API][eventstore].
18
+
19
+ ## Versioning
20
+
21
+ Eventum follows [Semantic Versioning 2.0.0][semver]. Make sure to always bound
22
+ the major version when installing if you want to avoid breaking changes.
23
+
24
+ ## Documentation
25
+
26
+ This documentation tracks the latest changes in the `master` branch of this
27
+ repo. Some of the features described might not be available in older versions of
28
+ the gem (including the current stable version). Please consult the relevant git
29
+ tag (e.g. v0.0.7) if you need documentation for a specific Eventum version.
30
+
31
+ ## Installation
32
+
33
+ Add this line to your application's Gemfile:
34
+
35
+ ```ruby
36
+ gem "eventum"
37
+ ```
38
+
39
+ And then execute:
40
+
41
+ $ bundle
42
+
43
+ Or install it yourself as:
44
+
45
+ $ gem install eventum
46
+
47
+ ## Usage
48
+
49
+ TODO: Write usage instructions here
50
+
51
+ ## Contributing
52
+
53
+ Thank you for contributing! We always welcome bug reports and/or pull requests.
54
+ Please take the time to go through our [contribution guidelines][contribute].
55
+
56
+ Special thanks to all the awesome people who have helped make this gem better.
57
+ You can see a list of them [here][contributors].
58
+
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the [MIT License][mit].
62
+ See [LICENSE.txt][license] for more details.
63
+
64
+ ---
65
+
66
+ <p align="center">
67
+ <img src="logos/skookum_mark_black.png" alt="Skookum" width="100" />
68
+ </p>
69
+
70
+ [eventstore]: https://geteventstore.com
71
+ [semver]: http://semver.org
72
+ [contribute]: CONTRIBUTING.md
73
+ [contributors]: https://github.com/Skookum/eventum/graphs/contributors
74
+ [mit]: http://opensource.org/licenses/MIT
75
+ [license]: LICENSE.txt
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require "rspec/core/rake_task"
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require "rubocop/rake_task"
7
+ RuboCop::RakeTask.new(:rubocop) do |task|
8
+ task.requires << "rubocop-rspec"
9
+ end
10
+
11
+ task default: :spec
12
+ task ci: %i(spec rubocop)
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "eventum"
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
+ require "pry"
10
+ Pry.start
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "eventum/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "eventum"
8
+ spec.version = Eventum::VERSION
9
+ spec.authors = ["Enrique Gonzalez"]
10
+ spec.email = ["enriikke@gmail.com"]
11
+
12
+ spec.summary = "A Ruby wrapper for the Event Store API."
13
+ spec.description = "A Ruby wrapper for the Event Store API."
14
+ spec.homepage = "http://github.com/Skookum/eventum"
15
+ spec.license = "MIT"
16
+
17
+ spec.require_paths = ["lib"]
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |file|
21
+ file.match(%r{^(test|spec|features|png|svg)/})
22
+ end
23
+
24
+ spec.required_ruby_version = ">= 2.1"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.10"
27
+ spec.add_development_dependency "rake", "~> 10.4"
28
+ spec.add_development_dependency "rspec", "~> 3.1"
29
+ spec.add_development_dependency "webmock", "~> 1.21"
30
+ spec.add_development_dependency "vcr", "~> 2.9"
31
+
32
+ spec.add_dependency "virtus", "~> 1.0"
33
+ spec.add_dependency "faraday", "~> 0.9"
34
+ end
@@ -0,0 +1,41 @@
1
+ require "eventum/version"
2
+ require "eventum/configurable"
3
+ require "eventum/connection"
4
+ require "eventum/api"
5
+ require "eventum/client"
6
+ require "eventum/client/streams"
7
+ require "eventum/client/events"
8
+
9
+ # Ruby client for the Event Store API
10
+ module Eventum
11
+ class << self
12
+ include Eventum::Configurable
13
+
14
+ # Alias for {Eventum::Client.new} using module configurations
15
+ #
16
+ # @yield [Eventum::Client]
17
+ # A configurable object
18
+ #
19
+ # @example
20
+ # Eventum.new do |config|
21
+ # config.adapter = :excon
22
+ # config.host = "http://localhost"
23
+ # config.port = 2121
24
+ # end
25
+ #
26
+ # @return [Eventum::Client]
27
+ #
28
+ # @api public
29
+ def new
30
+ client = Eventum::Client.new do |config|
31
+ config.adapter = adapter
32
+ config.host = host
33
+ config.port = port
34
+ end
35
+
36
+ yield client if block_given?
37
+
38
+ client
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,37 @@
1
+ module Eventum
2
+ # Core API interface
3
+ class API
4
+ # Creates a new instance of kind {Eventum::API}
5
+ #
6
+ # @param config [Eventum::Configurable] a configuration object
7
+ #
8
+ # @return [Eventum::API]
9
+ #
10
+ # @api public
11
+ def initialize(config)
12
+ @config = config
13
+ end
14
+
15
+ private
16
+
17
+ # Executes a GET request on the given path
18
+ #
19
+ # @param path [String] the path of the endpoint to request
20
+ #
21
+ # @return [Faraday::Response]
22
+ #
23
+ # @api private
24
+ def get(path)
25
+ connection.execute(method: :get, path: path, config: @config)
26
+ end
27
+
28
+ # Points to an {Eventum::Connection} object
29
+ #
30
+ # @return [Eventum::Connection]
31
+ #
32
+ # @api private
33
+ def connection
34
+ @connection ||= Eventum::Connection.new
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,45 @@
1
+ module Eventum
2
+ # Client for the Event Store API
3
+ #
4
+ # @includes {Eventum::Configurable}
5
+ class Client
6
+ include Eventum::Configurable
7
+
8
+ # Creates a new instance of {Eventum::Client}
9
+ #
10
+ # @yield [self]
11
+ # A configurable object
12
+ #
13
+ # @example
14
+ # Eventum::Client.new do |config|
15
+ # config.adapter = :excon
16
+ # config.host = "http://localhost"
17
+ # config.port = 2121
18
+ # end
19
+ #
20
+ # @return [Eventum::Client]
21
+ #
22
+ # @api public
23
+ def initialize
24
+ yield self if block_given?
25
+ end
26
+
27
+ # Points to a `streams` API client
28
+ #
29
+ # @return [Eventum::Client::Streams]
30
+ #
31
+ # @api public
32
+ def streams
33
+ @streams ||= Eventum::Client::Streams.new(self)
34
+ end
35
+
36
+ # Points to an `events` API client
37
+ #
38
+ # @return [Eventum::Client::Events]
39
+ #
40
+ # @api public
41
+ def events
42
+ @events ||= Eventum::Client::Events.new(self)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,27 @@
1
+ module Eventum
2
+ class Client
3
+ # API client for the `events` resource
4
+ class Events < Eventum::API
5
+ # The events API path
6
+ #
7
+ # @return [String]
8
+ API_PATH = "/streams".freeze
9
+
10
+ # Get a single event
11
+ #
12
+ # @param stream [String] the unique name of the stream
13
+ # @param number [String] the event number
14
+ #
15
+ # @example
16
+ # client = Eventum.new
17
+ # client.events.find("stream-name", "event-number")
18
+ #
19
+ # @return [Hash]
20
+ #
21
+ # @api public
22
+ def find(stream, number)
23
+ get("#{API_PATH}/#{stream}/#{number}")
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ module Eventum
2
+ class Client
3
+ # API client for the `streams` resource
4
+ class Streams < Eventum::API
5
+ # The streams API path
6
+ #
7
+ # @return [String]
8
+ API_PATH = "/streams".freeze
9
+
10
+ # Get a single stream
11
+ #
12
+ # @param name [String] the unique name of the stream
13
+ #
14
+ # @example
15
+ # client = Eventum.new
16
+ # client.streams.find("stream-name")
17
+ #
18
+ # @return [Hash]
19
+ #
20
+ # @api public
21
+ def find(name)
22
+ get("#{API_PATH}/#{name}")
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,91 @@
1
+ require "virtus"
2
+
3
+ module Eventum
4
+ # Configuration options for {self} with default values
5
+ #
6
+ # @!attribute [rw] adapter
7
+ # The adapter to be used by Faraday. Defaults to `:net_http`. Other
8
+ # options include `:typhoeus`, `:patron`, `:excon`, `:test`
9
+ #
10
+ # @!attribute [rw] host
11
+ # The host of the Event Store instance. Defaults to `http://localhost`
12
+ #
13
+ # @!attribute [rw] port
14
+ # The port of the Event Store instance. Defaults to `2113`
15
+ module Configurable
16
+ include Virtus.module(constructor: false, coerce: false)
17
+
18
+ # Default Faraday adapter
19
+ #
20
+ # @return [Symbol]
21
+ ADAPTER = :net_http
22
+
23
+ # Default Event Store host
24
+ #
25
+ # @return [String]
26
+ HOST = "http://localhost".freeze
27
+
28
+ # Default Event Store port
29
+ #
30
+ # @return [String]
31
+ PORT = "2113".freeze
32
+
33
+ attribute :adapter, String, default: ADAPTER, lazy: true
34
+ attribute :host, String, default: HOST, lazy: true
35
+ attribute :port, String, default: PORT, lazy: true
36
+
37
+ # Allows to configure {self}
38
+ #
39
+ # @example
40
+ # Eventum.configure do |config|
41
+ # config.adapter = :typhoeus
42
+ # config.host = "http://localhost"
43
+ # config.port = 2121
44
+ # end
45
+ #
46
+ # @yield [self]
47
+ # A configurable object
48
+ #
49
+ # @return [nil]
50
+ #
51
+ # @api public
52
+ def configure
53
+ yield self if block_given?
54
+ end
55
+
56
+ # List of configuration properties
57
+ #
58
+ # @return [Array]
59
+ #
60
+ # @api public
61
+ def config_props
62
+ %i(adapter host port)
63
+ end
64
+
65
+ # Resets the configuration properties to default values
66
+ #
67
+ # @return [nil]
68
+ #
69
+ # @api public
70
+ def reset!
71
+ config_props.each do |prop|
72
+ instance_variable_set(:"@#{prop}", defaults[prop])
73
+ end
74
+ end
75
+
76
+ private
77
+
78
+ # Holds default configuration
79
+ #
80
+ # @return [Hash]
81
+ #
82
+ # @api private
83
+ def defaults
84
+ {
85
+ adapter: ADAPTER,
86
+ host: HOST,
87
+ port: PORT
88
+ }.freeze
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,50 @@
1
+ require "faraday"
2
+
3
+ module Eventum
4
+ # Contains HTTP connection options
5
+ class Connection
6
+ # Performs an HTTP request
7
+ #
8
+ # @param method [Symbol] the HTTP method to perform
9
+ # @param path [String] the path of the URL endpoint to request
10
+ # @param config [Eventum::Configurable] a configuration object
11
+ #
12
+ # @return [Faraday::Response]
13
+ #
14
+ # @api private
15
+ def execute(method:, path:, config:)
16
+ conn(config).send(method) do |request|
17
+ request.url path
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ # The HTTP connection object
24
+ #
25
+ # @param config [Eventum::Configurable] a configuration object
26
+ #
27
+ # @return [Faraday::Connection]
28
+ #
29
+ # @api private
30
+ def conn(config)
31
+ Faraday.new(url: "#{config.host}:#{config.port}") do |faraday|
32
+ faraday.request :url_encoded
33
+ faraday.adapter config.adapter
34
+ faraday.headers = headers
35
+ end
36
+ end
37
+
38
+ # The default headers for the request
39
+ #
40
+ # @return [Hash]
41
+ #
42
+ # @api private
43
+ def headers
44
+ {
45
+ ACCEPT: "application/json".freeze,
46
+ CONTENT_TYPE: "application/json".freeze
47
+ }
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,21 @@
1
+ module Eventum
2
+ # Major release version describes incompatible API changes
3
+ #
4
+ # @return [Integer]
5
+ MAJOR = 0
6
+
7
+ # Minor release version describes new backwards-compatible functionality
8
+ #
9
+ # @return [Integer]
10
+ MINOR = 0
11
+
12
+ # Patch release version describes backwards-compatible bug fixes
13
+ #
14
+ # @return [Integer]
15
+ PATCH = 1
16
+
17
+ # Full release version that follows Semantic Versioning 2.0.0
18
+ #
19
+ # @return [String]
20
+ VERSION = [MAJOR, MINOR, PATCH].join(".").freeze
21
+ end
@@ -0,0 +1,175 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ viewBox="0 0 808 808" enable-background="new 0 0 808 808" xml:space="preserve">
6
+ <g enable-background="new ">
7
+ <g>
8
+ <defs>
9
+ <rect id="SVGID_1_" x="120" y="163" width="570" height="486"/>
10
+ </defs>
11
+ <clipPath id="SVGID_2_">
12
+ <use xlink:href="#SVGID_1_" overflow="visible"/>
13
+ </clipPath>
14
+ <g clip-path="url(#SVGID_2_)">
15
+ <defs>
16
+ <rect id="SVGID_3_" width="808" height="808"/>
17
+ </defs>
18
+ <clipPath id="SVGID_4_">
19
+ <use xlink:href="#SVGID_3_" overflow="visible"/>
20
+ </clipPath>
21
+ <g clip-path="url(#SVGID_4_)">
22
+ <defs>
23
+ <path id="SVGID_5_" d="M593.3,648.6H423.4c-2.9,0-5.3-2.4-5.3-5.3l-0.1-269.1c0-1.2,1.4-1.3,1.6-0.1l13.7,91.6
24
+ c4.7,31,27.7,70.5,52.2,89.9l109.9,86.6C600.1,645.7,599.1,648.6,593.3,648.6"/>
25
+ </defs>
26
+ <clipPath id="SVGID_6_">
27
+ <use xlink:href="#SVGID_5_" overflow="visible"/>
28
+ </clipPath>
29
+ <g clip-path="url(#SVGID_6_)">
30
+ <defs>
31
+ <rect id="SVGID_7_" width="808" height="808"/>
32
+ </defs>
33
+ <clipPath id="SVGID_8_">
34
+ <use xlink:href="#SVGID_7_" overflow="visible"/>
35
+ </clipPath>
36
+ <rect x="413.1" y="368.2" clip-path="url(#SVGID_8_)" width="190.3" height="285.4"/>
37
+ </g>
38
+ </g>
39
+ </g>
40
+ <g clip-path="url(#SVGID_2_)">
41
+ <defs>
42
+ <rect id="SVGID_9_" width="808" height="808"/>
43
+ </defs>
44
+ <clipPath id="SVGID_10_">
45
+ <use xlink:href="#SVGID_9_" overflow="visible"/>
46
+ </clipPath>
47
+ <g clip-path="url(#SVGID_10_)">
48
+ <defs>
49
+ <path id="SVGID_11_" d="M388.7,374.1l-13.8,91.6c-4.7,31-27.7,70.5-52.2,89.9l-109.9,86.6c-4.6,3.6-3.6,6.5,2.2,6.5h169.9
50
+ c2.9,0,5.3-2.4,5.3-5.3l0.1-269.1C390.2,373,388.8,372.9,388.7,374.1"/>
51
+ </defs>
52
+ <clipPath id="SVGID_12_">
53
+ <use xlink:href="#SVGID_11_" overflow="visible"/>
54
+ </clipPath>
55
+ <g clip-path="url(#SVGID_12_)">
56
+ <defs>
57
+ <rect id="SVGID_13_" width="808" height="808"/>
58
+ </defs>
59
+ <clipPath id="SVGID_14_">
60
+ <use xlink:href="#SVGID_13_" overflow="visible"/>
61
+ </clipPath>
62
+ <rect x="204.9" y="368.2" clip-path="url(#SVGID_14_)" width="190.3" height="285.4"/>
63
+ </g>
64
+ </g>
65
+ </g>
66
+ <g clip-path="url(#SVGID_2_)">
67
+ <defs>
68
+ <rect id="SVGID_15_" width="808" height="808"/>
69
+ </defs>
70
+ <clipPath id="SVGID_16_">
71
+ <use xlink:href="#SVGID_15_" overflow="visible"/>
72
+ </clipPath>
73
+ <g clip-path="url(#SVGID_16_)">
74
+ <defs>
75
+ <path id="SVGID_17_" d="M686.3,484.6L497,167.7c-1.4-2.3-4.6-4.1-7.3-4.1h-170c-2.6,0-5.9,1.9-7.3,4.1l-189,316.8
76
+ c-2.9,4.9-0.9,7.4,4.5,5.7L283.5,440c12.8-4.1,28-18.9,32.6-31.6l63.8-178.1c1-2.7,4.1-5,7-5h34.8c2.9,0,6.1,2.3,7,5
77
+ l63.8,178.1c4.6,12.7,19.8,27.5,32.6,31.6l156.8,50.4C687.2,492,689.2,489.5,686.3,484.6"/>
78
+ </defs>
79
+ <clipPath id="SVGID_18_">
80
+ <use xlink:href="#SVGID_17_" overflow="visible"/>
81
+ </clipPath>
82
+ <g clip-path="url(#SVGID_18_)">
83
+ <defs>
84
+ <rect id="SVGID_19_" width="808" height="808"/>
85
+ </defs>
86
+ <clipPath id="SVGID_20_">
87
+ <use xlink:href="#SVGID_19_" overflow="visible"/>
88
+ </clipPath>
89
+ <rect x="117.2" y="158.6" clip-path="url(#SVGID_20_)" width="575.4" height="337.2"/>
90
+ </g>
91
+ </g>
92
+ </g>
93
+ <g clip-path="url(#SVGID_2_)">
94
+ <defs>
95
+ <rect id="SVGID_21_" width="808" height="808"/>
96
+ </defs>
97
+ <clipPath id="SVGID_22_">
98
+ <use xlink:href="#SVGID_21_" overflow="visible"/>
99
+ </clipPath>
100
+ <g clip-path="url(#SVGID_22_)">
101
+ <defs>
102
+ <path id="SVGID_23_" d="M347.4,461.4l13.6-90.2c0.2-1.3-1.5-2-2-0.5l-16.7,47.2c-7.4,20.7-29.5,42.1-50.2,48.8l-162.5,52.5
103
+ c-3.1,1-4.2,4-2.4,6.8l59.2,94c1.7,2.7,5.2,3.3,7.7,1.3l111.5-87.8C324.5,518.5,343.7,485.5,347.4,461.4"/>
104
+ </defs>
105
+ <clipPath id="SVGID_24_">
106
+ <use xlink:href="#SVGID_23_" overflow="visible"/>
107
+ </clipPath>
108
+ <g clip-path="url(#SVGID_24_)">
109
+ <defs>
110
+ <rect id="SVGID_25_" width="808" height="808"/>
111
+ </defs>
112
+ <clipPath id="SVGID_26_">
113
+ <use xlink:href="#SVGID_25_" overflow="visible"/>
114
+ </clipPath>
115
+ <rect x="121.2" y="364.9" clip-path="url(#SVGID_26_)" width="244.8" height="262.6"/>
116
+ </g>
117
+ </g>
118
+ </g>
119
+ <g clip-path="url(#SVGID_2_)">
120
+ <defs>
121
+ <rect id="SVGID_27_" width="808" height="808"/>
122
+ </defs>
123
+ <clipPath id="SVGID_28_">
124
+ <use xlink:href="#SVGID_27_" overflow="visible"/>
125
+ </clipPath>
126
+ <g clip-path="url(#SVGID_28_)">
127
+ <defs>
128
+ <path id="SVGID_29_" d="M678.9,519.1l-162.5-52.5c-20.8-6.7-42.8-28.2-50.2-48.8l-16.7-47.2c-0.5-1.5-2.2-0.8-2,0.5l13.5,90.2
129
+ c3.7,24,22.8,57.1,41.9,72l111.5,87.8c2.5,2,6,1.4,7.7-1.3l59.3-94C683,523.2,681.9,520.1,678.9,519.1"/>
130
+ </defs>
131
+ <clipPath id="SVGID_30_">
132
+ <use xlink:href="#SVGID_29_" overflow="visible"/>
133
+ </clipPath>
134
+ <g clip-path="url(#SVGID_30_)">
135
+ <defs>
136
+ <rect id="SVGID_31_" width="808" height="808"/>
137
+ </defs>
138
+ <clipPath id="SVGID_32_">
139
+ <use xlink:href="#SVGID_31_" overflow="visible"/>
140
+ </clipPath>
141
+ <rect x="442.4" y="364.9" clip-path="url(#SVGID_32_)" width="244.7" height="262.6"/>
142
+ </g>
143
+ </g>
144
+ </g>
145
+ <g clip-path="url(#SVGID_2_)">
146
+ <defs>
147
+ <rect id="SVGID_33_" width="808" height="808"/>
148
+ </defs>
149
+ <clipPath id="SVGID_34_">
150
+ <use xlink:href="#SVGID_33_" overflow="visible"/>
151
+ </clipPath>
152
+ <g clip-path="url(#SVGID_34_)">
153
+ <defs>
154
+ <path id="SVGID_35_" d="M590.5,246.3c0-9.2,7.3-16.8,16.2-16.8s16.2,7.6,16.2,16.8s-7.3,16.8-16.2,16.8
155
+ S590.5,255.5,590.5,246.3z M586,246.3c0,11.8,9.3,21.3,20.7,21.3c11.5,0,20.7-9.5,20.7-21.3c0-11.8-9.3-21.3-20.7-21.3
156
+ C595.3,225,586,234.5,586,246.3z M610.2,242c0,3.2-2.9,3.4-6.9,3.4v-6.6C608.4,238.8,610.2,239.1,610.2,242z M616.8,258
157
+ l-6.7-9.5c3-1,4.6-3.8,4.6-6.6c0-4.8-2.8-6.8-11.2-6.8h-4.6V258h4.4v-9.3h1.5l6.7,9.3H616.8z"/>
158
+ </defs>
159
+ <clipPath id="SVGID_36_">
160
+ <use xlink:href="#SVGID_35_" overflow="visible"/>
161
+ </clipPath>
162
+ <g clip-path="url(#SVGID_36_)">
163
+ <defs>
164
+ <rect id="SVGID_37_" width="808" height="808"/>
165
+ </defs>
166
+ <clipPath id="SVGID_38_">
167
+ <use xlink:href="#SVGID_37_" overflow="visible"/>
168
+ </clipPath>
169
+ <rect x="581" y="220" clip-path="url(#SVGID_38_)" fill="#393939" width="51.5" height="52.7"/>
170
+ </g>
171
+ </g>
172
+ </g>
173
+ </g>
174
+ </g>
175
+ </svg>
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eventum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Enrique Gonzalez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-09-08 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.21'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.21'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.9'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: virtus
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: faraday
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.9'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.9'
111
+ description: A Ruby wrapper for the Event Store API.
112
+ email:
113
+ - enriikke@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".coveralls.yml"
119
+ - ".gitignore"
120
+ - ".hound.yml"
121
+ - ".rspec"
122
+ - ".rubocop.yml"
123
+ - ".travis.yml"
124
+ - CHANGELOG.md
125
+ - CODE_OF_CONDUCT.md
126
+ - CONTRIBUTING.md
127
+ - Gemfile
128
+ - Guardfile
129
+ - LICENSE.txt
130
+ - README.md
131
+ - Rakefile
132
+ - bin/console
133
+ - bin/setup
134
+ - eventum.gemspec
135
+ - lib/eventum.rb
136
+ - lib/eventum/api.rb
137
+ - lib/eventum/client.rb
138
+ - lib/eventum/client/events.rb
139
+ - lib/eventum/client/streams.rb
140
+ - lib/eventum/configurable.rb
141
+ - lib/eventum/connection.rb
142
+ - lib/eventum/version.rb
143
+ - logos/skookum_mark_black.png
144
+ - logos/skookum_mark_black.svg
145
+ homepage: http://github.com/Skookum/eventum
146
+ licenses:
147
+ - MIT
148
+ metadata: {}
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '2.1'
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubyforge_project:
165
+ rubygems_version: 2.4.8
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: A Ruby wrapper for the Event Store API.
169
+ test_files: []