gh-events 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a55bebd661fa282ed77d62961d6c3536884bcc73445d7ae322d649f5b96ae6d2
4
- data.tar.gz: 2adf190eee10e83cd1e5c3e86f53c7f846ef7c737377dc3a04bfa2e42864783e
3
+ metadata.gz: 536867ca0996403c7c14af95cdcc0fe09d64ff0f0255b1108807dc4b41e64043
4
+ data.tar.gz: 5c42253ec777d1d387969f9bb82ef4937b483234f8d1a385c15924b59b930f6e
5
5
  SHA512:
6
- metadata.gz: 8ff6eba75025b4703b4bfa2c6c74c6da65ba5806650ba6815efd24df01f85c4512de48b92a80cea16cf8d3a76a7ea32583928e7f298a0b43e607de609625fda2
7
- data.tar.gz: fd3ae344746ba5165f4fcdeab5067437db11076cd65365966eea3bd803fd7c845a96fcb567e6a8cf1b7c9e1589bd116df50502b0f9d5a2fe0942733b177fa6a8
6
+ metadata.gz: fed7a3180d966c34198af9c43f6be039bf873f5c75c9a04161be7c3019017edd0680c4386165f84e047f8bff9c297de00e26f8a834141f200b80d4d0c54114d6
7
+ data.tar.gz: ba6a71ca37b15b4f43f95e463f6ae74cd96e75cd537e39e0dcf6ebb5c148020c61b8f3e43edc55133f911604091ef952c5d3f7916a7e00db12cb2e3e3d78a8a2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gh-events (0.1.0)
4
+ gh-events (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,5 @@
1
1
  module GH
2
2
  module Events
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/gh/events.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "gh/events/version"
2
2
 
3
3
  require 'yaml'
4
+ require 'ostruct'
4
5
 
5
6
  module GH
6
7
  module Events
@@ -12,8 +13,11 @@ module GH
12
13
  HEURISTICS = YAML.load_file(PATH)
13
14
 
14
15
  def typeof(payload)
15
- keys = payload.keys
16
+ payload = payload.marshal_dump if payload.is_a?(OpenStruct)
17
+ keys = payload.keys.map(&:to_s)
16
18
  HEURISTICS.each do |type, characteristics|
19
+ # puts ("-" * 30) + " #{type}"
20
+
17
21
  # all keys in `present` are there
18
22
  x = ((characteristics['present'] || []) - keys)
19
23
  next unless x.empty?
@@ -26,8 +30,9 @@ module GH
26
30
  z = payload.dup.merge(characteristics['exactly'] || {}) == payload
27
31
  next unless z
28
32
 
29
- next if characteristics['number_of_keys'] &&
30
- keys.count != characteristics['number_of_keys']
33
+ n = characteristics['number_of_keys'] &&
34
+ keys.count != characteristics['number_of_keys']
35
+ next if n
31
36
 
32
37
  return type.to_sym
33
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh-events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Hofmann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2019-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler