g5_client_notifications_url 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/g5_client_notifications_url.gemspec +25 -0
- data/lib/g5_client_notifications_url.rb +25 -0
- data/lib/g5_client_notifications_url/version.rb +3 -0
- data/spec/g5_client_notifications_url_spec.rb +18 -0
- data/spec/spec_helper.rb +90 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b5eea24c7ac9af086e70e1631481c06a07533109
|
4
|
+
data.tar.gz: 9dd2868b7ae94967cb9b48ca12d2dbe5cbfab76f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f78f2b5cd98b4ad4b0d51b0b2efcf4c0d487115408bed4ea7510cef27d1407b80947cc0e62926f9ef0165d8346818351fc4d03c4d1bd0f100a3804341c9d381a
|
7
|
+
data.tar.gz: 8b5d5464888cba18252a496da1dfd9c5a04af1bf7d17cdbebf4fde443b07a7beb58b3c93e81d444512227cbed56f63a2f9f811b37bb782199a039eb74d3d86e3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 bbauer
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# G5 Client Notifications Url
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/g5_client_notifications_url.svg)](http://badge.fury.io/rb/g5_client_notifications_url)
|
4
|
+
[![Circle CI](https://circleci.com/gh/g5search/g5_client_notifications_url.svg?style=shield&circle-token=10241811356538fab4f0f77c5469a4a65a6864af)](https://circleci.com/gh/g5search/g5_client_notifications_url)
|
5
|
+
|
6
|
+
Generates a dashboard notifications url based off a client uid. The G5 Header
|
7
|
+
accepts a 'notifications_url', and most apps will probably use the dashboard's
|
8
|
+
view for this.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'g5_client_notifications_url'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install g5_client_notifications_url
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
client_uid = 'http://example.com/clients/some-uid'
|
30
|
+
G5ClientNotificationsUrl.build(client_uid)
|
31
|
+
```
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/g5_client_notifications_url/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
40
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'g5_client_notifications_url/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "g5_client_notifications_url"
|
8
|
+
spec.version = G5ClientNotificationsUrl::VERSION
|
9
|
+
spec.authors = ["bbauer"]
|
10
|
+
spec.email = ["brian.bauer@g5platform.com"]
|
11
|
+
spec.summary = %q{Builds a notifications url for client}
|
12
|
+
spec.description = %q{builds a notifications url for client}
|
13
|
+
spec.homepage = "https://github.com/g5search/g5_client_notifications_url"
|
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_dependency "g5_heroku_app_name_formatter"
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "g5_client_notifications_url/version"
|
2
|
+
require "g5_heroku_app_name_formatter"
|
3
|
+
|
4
|
+
module G5ClientNotificationsUrl
|
5
|
+
NOTIFICATIONS_ROUTE = 'notifications'
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def build(uid)
|
9
|
+
return '' if uid.nil?
|
10
|
+
|
11
|
+
"#{dsh_url(uid)}/#{NOTIFICATIONS_ROUTE}"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def urn(uid)
|
17
|
+
uid.split('/').last
|
18
|
+
end
|
19
|
+
|
20
|
+
def dsh_url(uid)
|
21
|
+
G5HerokuAppNameFormatter::Formatter.new(urn(uid), ['dsh']).dsh_url
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe G5ClientNotificationsUrl do
|
4
|
+
describe '.build' do
|
5
|
+
let(:client_uid) { 'http://g5-hub.herokuapp.com/clients/g5-c-6d4gqkl-demo' }
|
6
|
+
let(:expected_url) { 'https://g5-dsh-6d4gqkl-demo.herokuapp.com/notifications' }
|
7
|
+
|
8
|
+
subject(:build) { described_class.build(client_uid) }
|
9
|
+
|
10
|
+
specify { expect(build).to eq(expected_url) }
|
11
|
+
|
12
|
+
context 'no passed client_uid' do
|
13
|
+
let(:client_uid) { nil }
|
14
|
+
|
15
|
+
specify { expect(build).to eq('') }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'g5_client_notifications_url'
|
2
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
3
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
4
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
5
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need it.
|
13
|
+
#
|
14
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
15
|
+
# users commonly want.
|
16
|
+
#
|
17
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# rspec-expectations config goes here. You can use an alternate
|
20
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
+
# assertions if you prefer.
|
22
|
+
config.expect_with :rspec do |expectations|
|
23
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
+
# and `failure_message` of custom matchers include text for helper methods
|
25
|
+
# defined using `chain`, e.g.:
|
26
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
+
# # => "be bigger than 2 and smaller than 4"
|
28
|
+
# ...rather than:
|
29
|
+
# # => "be bigger than 2"
|
30
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
+
config.mock_with :rspec do |mocks|
|
36
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
+
# a real object. This is generally recommended, and will default to
|
38
|
+
# `true` in RSpec 4.
|
39
|
+
mocks.verify_partial_doubles = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# The settings below are suggested to provide a good initial experience
|
43
|
+
# with RSpec, but feel free to customize to your heart's content.
|
44
|
+
=begin
|
45
|
+
# These two settings work together to allow you to limit a spec run
|
46
|
+
# to individual examples or groups you care about by tagging them with
|
47
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
48
|
+
# get run.
|
49
|
+
config.filter_run :focus
|
50
|
+
config.run_all_when_everything_filtered = true
|
51
|
+
|
52
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
53
|
+
# For more details, see:
|
54
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
55
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
56
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
57
|
+
config.disable_monkey_patching!
|
58
|
+
|
59
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
60
|
+
# be too noisy due to issues in dependencies.
|
61
|
+
config.warnings = true
|
62
|
+
|
63
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
64
|
+
# file, and it's useful to allow more verbose output when running an
|
65
|
+
# individual spec file.
|
66
|
+
if config.files_to_run.one?
|
67
|
+
# Use the documentation formatter for detailed output,
|
68
|
+
# unless a formatter has already been configured
|
69
|
+
# (e.g. via a command-line flag).
|
70
|
+
config.default_formatter = 'doc'
|
71
|
+
end
|
72
|
+
|
73
|
+
# Print the 10 slowest examples and example groups at the
|
74
|
+
# end of the spec run, to help surface which specs are running
|
75
|
+
# particularly slow.
|
76
|
+
config.profile_examples = 10
|
77
|
+
|
78
|
+
# Run specs in random order to surface order dependencies. If you find an
|
79
|
+
# order dependency and want to debug it, you can fix the order by providing
|
80
|
+
# the seed, which is printed after each run.
|
81
|
+
# --seed 1234
|
82
|
+
config.order = :random
|
83
|
+
|
84
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
85
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
86
|
+
# test failures related to randomization by passing the same `--seed` value
|
87
|
+
# as the one that triggered the failure.
|
88
|
+
Kernel.srand config.seed
|
89
|
+
=end
|
90
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: g5_client_notifications_url
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- bbauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: g5_heroku_app_name_formatter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: builds a notifications url for client
|
70
|
+
email:
|
71
|
+
- brian.bauer@g5platform.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- g5_client_notifications_url.gemspec
|
83
|
+
- lib/g5_client_notifications_url.rb
|
84
|
+
- lib/g5_client_notifications_url/version.rb
|
85
|
+
- spec/g5_client_notifications_url_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
homepage: https://github.com/g5search/g5_client_notifications_url
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.4.5
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Builds a notifications url for client
|
111
|
+
test_files:
|
112
|
+
- spec/g5_client_notifications_url_spec.rb
|
113
|
+
- spec/spec_helper.rb
|