any_channel_json_schemas 0.0.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 +7 -0
- data/README.md +46 -0
- data/any_channel_json_schemas.gemspec +14 -0
- data/json_schemas +1 -0
- data/lib/any_channel_json_schemas.rb +16 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e2cda03b13f66c666aecc10835415c525f921692
|
4
|
+
data.tar.gz: f26e14d8bb3a81d117dab6b3494e439dc7421315
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a6df76b9bb33a11a223d6be09ad048e82d01eaf5c009c298a037b4fbbbd8576e9ee944b662fd2c08487886e87261db1cf9dd7144633874ddf92b798bc1bd0cd1
|
7
|
+
data.tar.gz: 7e8e3582b3d27d545f2f0b1b8f5012d12019d745d08918f82298d29f90ad910a2fa9440bb78c7145204ae03511e1b90bd2412ad3614b21b3c22272cc95856a8a
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Any Channel JSON Schemas
|
2
|
+
|
3
|
+
This is a gem that lets you reference JSON Schema files for the [Zendesk AnyChannel Framework](https://developer.zendesk.com/apps/docs/channels-framework/introduction) in your ruby projects.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
gem install any_channel_json_schemas
|
9
|
+
```
|
10
|
+
|
11
|
+
### Usage
|
12
|
+
|
13
|
+
The gem exposes a single module with the following methods:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
manifest
|
17
|
+
pull_payload
|
18
|
+
channelback_payload
|
19
|
+
push_parameters
|
20
|
+
event_base
|
21
|
+
event_pull_request
|
22
|
+
event_create_ris
|
23
|
+
event_resources_created_from_external_ids
|
24
|
+
```
|
25
|
+
|
26
|
+
Each of these returns an absolute path to a schema file. We use these in our own code base with the [json-schema](https://github.com/ruby-json-schema/json-schema) gem both in our test suite and to validate json payloads real-time.
|
27
|
+
|
28
|
+
Here's an example of how use the schemas to validate a [manifest](https://developer.zendesk.com/apps/docs/channels-framework/integration_manifest).
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
validation_errors = JSON::Validator.fully_validate(AnyChannelJSONSchemas.manifest, manifest)
|
32
|
+
|
33
|
+
if validation_errors.empty?
|
34
|
+
# Manifest conforms to the published schema.
|
35
|
+
else
|
36
|
+
# There are validation erros and we can't proceed.
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
### Contributing
|
41
|
+
|
42
|
+
Feel free to open an issue or fork the repo and submit a PR.
|
43
|
+
|
44
|
+
### Contact
|
45
|
+
|
46
|
+
jshay@zendesk.com
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.authors = ['JaredShay']
|
3
|
+
gem.email = ['jshay@zendesk.com']
|
4
|
+
gem.description = %q{JSON schema files for the Zendesk Channels Framework.}
|
5
|
+
gem.summary = %q{JSON schema files for the Zendesk Channels Framework.}
|
6
|
+
gem.homepage = 'https://github.com/zendesk/any_channel_json_schemas/ruby'
|
7
|
+
|
8
|
+
gem.files = `git ls-files`.split("\n")
|
9
|
+
gem.test_files = `git ls-files -- spec/*`.split("\n")
|
10
|
+
gem.name = 'any_channel_json_schemas'
|
11
|
+
gem.require_paths = ['lib']
|
12
|
+
gem.version = '0.0.0'
|
13
|
+
gem.license = 'Apache-2.0'
|
14
|
+
end
|
data/json_schemas
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
./../json_schemas
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# The AnyChannelJSONSchemas module exposes a single method for each json schema file in the json_schemas directory.
|
2
|
+
# Each method returns the full file path as a string.
|
3
|
+
#
|
4
|
+
# eg.
|
5
|
+
# AnyChannelJSONSchemas.manifest
|
6
|
+
# => "<full_file_path_to_gem>/manifest.json"
|
7
|
+
module AnyChannelJSONSchemas
|
8
|
+
Dir["#{File.dirname(File.expand_path(__FILE__))}/../json_schemas/*.json"].each do |file_path|
|
9
|
+
basename = File.basename(file_path, '.json')
|
10
|
+
|
11
|
+
define_method(basename) do
|
12
|
+
file_path
|
13
|
+
end
|
14
|
+
module_function basename.to_sym
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: any_channel_json_schemas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- JaredShay
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: JSON schema files for the Zendesk Channels Framework.
|
14
|
+
email:
|
15
|
+
- jshay@zendesk.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- README.md
|
21
|
+
- any_channel_json_schemas.gemspec
|
22
|
+
- json_schemas
|
23
|
+
- lib/any_channel_json_schemas.rb
|
24
|
+
homepage: https://github.com/zendesk/any_channel_json_schemas/ruby
|
25
|
+
licenses:
|
26
|
+
- Apache-2.0
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.5.1
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: JSON schema files for the Zendesk Channels Framework.
|
48
|
+
test_files: []
|