datumfactory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f894820936bc03f06a3b84379fe706d88c72dae1f32be39a752f96bd277181aa
4
+ data.tar.gz: 9db8449f2d72faecb1fc8190bcadd4dcd84125bc1cbe08bda89ca159b74d5162
5
+ SHA512:
6
+ metadata.gz: c4dc2807dd987364f0ed8f551302c1b1a930083a012f424323699d8586c1bc576c1f00b60183c73e0022cc2eaf2ba6edc5fb60cb911d481bf89c65f6191fe6a0
7
+ data.tar.gz: 87357100422226444c621efbadd5dd1dd28b7de744f8d116a21ca9f70dc87e0e2026cd843b11d59bcd4eba6a956a4c3acfd18aaa836a0f270804d435c622339a
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .ruby-version
10
+ .ruby-gemset
11
+ /*.gem
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at rbazinet@stillriversoftware.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in datumfactory.gemspec
6
+ gemspec
7
+
8
+ gem 'minitest', '~> 5.0'
9
+ gem 'rake', '~> 12.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ datumfactory (0.1.0)
5
+ httparty (~> 0.18.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ httparty (0.18.1)
11
+ mime-types (~> 3.0)
12
+ multi_xml (>= 0.5.2)
13
+ mime-types (3.3.1)
14
+ mime-types-data (~> 3.2015)
15
+ mime-types-data (3.2021.0225)
16
+ minitest (5.14.4)
17
+ multi_xml (0.6.0)
18
+ rake (12.3.3)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ datumfactory!
25
+ minitest (~> 5.0)
26
+ rake (~> 12.0)
27
+
28
+ BUNDLED WITH
29
+ 2.2.15
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Rob Bazinet
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.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Datumfactory for Ruby
2
+
3
+ Use this Ruby gem to access and use the [Datum Factory](https://datumfactory.com/) event tracking service. [Sign up](https://datumfactory.com/register) for an account before using this gem.
4
+
5
+ **Note:** we are currently in beta.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'datumfactory'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install datumfactory-ruby
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 test` 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]/datumfactory-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/datumfactory-ruby/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
+
42
+ ## Code of Conduct
43
+
44
+ Everyone interacting in the Datumfactory for Ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/datumfactory-ruby/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/datumfactory/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'datumfactory'
7
+ spec.version = Datumfactory::VERSION
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.summary = 'Event tracking for your applications.'
10
+ spec.description = 'Track key events in your application.'
11
+ spec.authors = ['Rob Bazinet']
12
+ spec.email = ['rbazinet@stillriversoftware.com']
13
+ spec.homepage = 'https://github.com/rbazinet/datumfactory-ruby'
14
+ spec.license = 'MIT'
15
+
16
+ spec.required_ruby_version = '>= 2.3.0'
17
+
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://github.com/rbazinet/datumfactory-ruby'
20
+ spec.metadata['changelog_uri'] = 'https://github.com/rbazinet/datumfactory-ruby'
21
+
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_dependency 'httparty', '~> 0.18.1'
30
+ # spec.executables << 'datumfactory'
31
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'datumfactory/version'
4
+ require 'httparty'
5
+ require 'json'
6
+
7
+ module Datumfactory
8
+ class Error < StandardError; end
9
+
10
+ class Events
11
+ include HTTParty
12
+
13
+ attr_reader :auth_token
14
+
15
+ format :json
16
+ base_uri "datumfactory.com"
17
+
18
+ def initialize(site, email, password)
19
+ self.class.base_uri "#{site}.datumfactory.com"
20
+ @site = site
21
+ @email = email
22
+ @password = password
23
+ @options = {
24
+ headers: {
25
+ 'Content-Type' => 'application/json'
26
+ }
27
+ }
28
+ end
29
+
30
+ def login
31
+ result = self.class.post('/api/login', @options.merge(
32
+ query: {
33
+ "email": @email,
34
+ "password": @password
35
+ }
36
+ ))
37
+ @auth_token = result['auth_token']
38
+ end
39
+
40
+ def get(id)
41
+ self.class.get("/api/v1/events/#{id}", @options.merge({ headers: { 'Authorization' => "Bearer #{@auth_token}" } })).parsed_response
42
+ end
43
+
44
+ def all
45
+ self.class.get('/api/v1/events', @options.merge({ headers: { 'Authorization' => "Bearer #{@auth_token}" } })).parsed_response
46
+ end
47
+
48
+ def destroy(id)
49
+ self.class.delete("/api/v1/events/#{id}", @options.merge({ headers: { 'Authorization' => "Bearer #{@auth_token}" } }))
50
+ end
51
+
52
+ def by_slug(id)
53
+ self.class.get("/api/v1/events/by-slug/#{id}", @options.merge({ headers: { 'Authorization' => "Bearer #{@auth_token}" } })).parsed_response
54
+ end
55
+
56
+ def create(data, title, slug, description = nil)
57
+ body = {
58
+ query: {
59
+ event: {
60
+ data: data,
61
+ title: title,
62
+ description: description,
63
+ slug: slug
64
+ }
65
+ }
66
+ }
67
+
68
+ @options.merge!({ headers: { 'Authorization' => "Bearer #{@auth_token}" } })
69
+ @options.merge!(body)
70
+ self.class.post('/api/v1/events', @options).parsed_response
71
+ end
72
+ end
73
+ end
74
+
@@ -0,0 +1,3 @@
1
+ module Datumfactory
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: datumfactory
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rob Bazinet
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-04-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.18.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.18.1
27
+ description: Track key events in your application.
28
+ email:
29
+ - rbazinet@stillriversoftware.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - CODE_OF_CONDUCT.md
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - datumfactory.gemspec
42
+ - lib/datumfactory.rb
43
+ - lib/datumfactory/version.rb
44
+ homepage: https://github.com/rbazinet/datumfactory-ruby
45
+ licenses:
46
+ - MIT
47
+ metadata:
48
+ homepage_uri: https://github.com/rbazinet/datumfactory-ruby
49
+ source_code_uri: https://github.com/rbazinet/datumfactory-ruby
50
+ changelog_uri: https://github.com/rbazinet/datumfactory-ruby
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 2.3.0
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubygems_version: 3.0.3
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Event tracking for your applications.
70
+ test_files: []