Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
Genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
foscomputerservices committed Apr 21, 2015
0 parents commit 82fcb21
Show file tree
Hide file tree
Showing 16 changed files with 306 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
2 changes: 2 additions & 0 deletions .rspec
@@ -0,0 +1,2 @@
--color
--format documentation
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in dmtd_vbmapp_data.gemspec
gemspec
21 changes: 21 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Data Makes the Difference, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
@@ -0,0 +1,39 @@
# DmtdVbmapp

The gem is provided to ease access to DMTD's vbmappdata.com service.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'dmtd_vbmapp_data'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install dmtd_vbmapp_data

## Configuration

Upon receiving an authorization token from Data Makes the Difference, add the following line to your application's configuration:

DmtdVbmappData.configure auth_token: 'auth_token'

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.

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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

1. Fork it ( https://github.com/[my-github-username]/dmtd_vbmapp_data/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
1 change: 1 addition & 0 deletions Rakefile
@@ -0,0 +1 @@
require "bundler/gem_tasks"
14 changes: 14 additions & 0 deletions bin/console
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require 'bundler/setup'
require 'dmtd_vbmapp_data'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require 'irb'
IRB.start
7 changes: 7 additions & 0 deletions bin/setup
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

bundle install

# Do any other automated setup that you need to do here
28 changes: 28 additions & 0 deletions dmtd_vbmapp_data.gemspec
@@ -0,0 +1,28 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dmtd_vbmapp_data/version'

Gem::Specification.new do |spec|
spec.name = 'dmtd_vbmapp_data'
spec.version = DmtdVbmappData::VERSION
spec.authors = ['David Hunt']
spec.email = ['support@vbmappapp.com']

spec.summary = %q{Ruby gem to simplify access to DMTD's VB-MAPP REST service}
spec.description = %q{This gem provides a simplified Ruby API for DMTD customers accessing the vbmappdata.com REST service.}
spec.homepage = 'http://vbmappdata.com'
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_dependency 'psych', '~> 2.0'

spec.add_development_dependency 'bundler', '~> 1.9'
spec.add_development_dependency 'rake', '~> 10.0'

spec.add_development_dependency 'rspec', '~> 3.2'
end
34 changes: 34 additions & 0 deletions lib/dmtd_vbmapp_data.rb
@@ -0,0 +1,34 @@
require 'dmtd_vbmapp_data/version'
require 'dmtd_vbmapp_data/guide'
require 'psych'

module DmtdVbmappData

@config = {
server_url: 'http://vbmappdata.com',
auth_token: ''
}

@valid_config_keys = @config.keys

def self.configure(opts = {})
opts.each {|k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
end

def self.configure_with(path_to_yaml_file)
begin
config = Psych::load(IO.read(path_to_yaml_file))
rescue Errno::ENOENT
log(:warning, "YAML configuration file couldn't be found. Using defaults."); return
rescue Psych::SyntaxError
log(:warning, 'YAML configuration file contains invalid syntax. Using defaults.'); return
end

configure(config)
end

def self.config
@config
end

end
9 changes: 9 additions & 0 deletions lib/dmtd_vbmapp_data/guide.rb
@@ -0,0 +1,9 @@
module DmtdVbmappData

class Guide



end

end
3 changes: 3 additions & 0 deletions lib/dmtd_vbmapp_data/version.rb
@@ -0,0 +1,3 @@
module DmtdVbmappData
VERSION = '0.1.0'
end
26 changes: 26 additions & 0 deletions spec/config_spec.rb
@@ -0,0 +1,26 @@
require 'spec_helper'

describe 'configure' do

it 'allows setting the server url' do
test_url = 'foo.bar'
DmtdVbmappData.configure server_url: test_url

expect(DmtdVbmappData.config[:server_url]).to eq(test_url)
end

it 'allows setting the auth token' do
auth_token = '123456'
DmtdVbmappData.configure auth_token: auth_token

expect(DmtdVbmappData.config[:auth_token]).to eq(auth_token)
end

it 'allows setting via YAML file' do
DmtdVbmappData.configure_with File.join(__dir__, 'test_config.yaml')

expect(DmtdVbmappData.config[:server_url]).to eq('foo.bar.zap')
expect(DmtdVbmappData.config[:auth_token]).to eq('123abc')
end

end
13 changes: 13 additions & 0 deletions spec/guide_spec.rb
@@ -0,0 +1,13 @@
require 'spec_helper'

module DmtdVbmappData

describe Guide do

it 'Can be created' do
expect(Guide.new).to_not be nil
end

end

end
94 changes: 94 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,94 @@
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration

require 'dmtd_vbmapp_data'

RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
config.disable_monkey_patching!
# This setting enables warnings. It's recommended, but in some cases may
# be too noisy due to issues in dependencies.
config.warnings = true
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end
2 changes: 2 additions & 0 deletions spec/test_config.yaml
@@ -0,0 +1,2 @@
server_url: 'foo.bar.zap'
auth_token: '123abc'

0 comments on commit 82fcb21

Please sign in to comment.