omnihooks-weebly 0.0.1

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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzA3MGM1ZDhjZmE3ZGY1MGY1MDk1Zjc4MWRiY2FkMTcyMDRiODQ2OA==
5
+ data.tar.gz: !binary |-
6
+ ODUwZmU1ZTYwMWMyNzViMjE1MTA0NGQ2MjhlMjRjMjIwMjU5Njg0NQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NWM0ODAwNTk5N2JmODk5MDBiMDIzYjM5YmU2Yzk1YjQxNGExNDViZmQxYTYw
10
+ NGY1NTY1OWIwYjFjYTIxMWQ5MTllN2I5NjljMGE5MTQ2MjdjMTI0MTM1NDdl
11
+ ZjZiMWIyZTVlN2FmOTU0ODdkNDM0ZWQ2NDk1OWI5YjYwZGE2MzA=
12
+ data.tar.gz: !binary |-
13
+ MTNmZmNhZDRkYTA5YTVhNDY2ZDQ1NTcwZjg0YWQ4NDlhOWRkMzBmNDcwMjBk
14
+ ZGYxZDMzODA2MjI2ZDBjYjM3Yjc1NjliZTY1NjNjYjQzNzQ2NjY2MWU0NGY5
15
+ YmJkZjFhYjZjNDFhNzMzZDA1NGViMjI5YTgyMzc0ZDIzZDc1ZGQ=
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ /spec/examples.txt
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omnihooks-weebly.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Karl Falconer
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,31 @@
1
+ # Omnihooks::Weebly
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omnihooks-weebly'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omnihooks-weebly
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/omnihooks-weebly/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ require 'omnihooks'
2
+ require 'multi_json'
3
+
4
+ module OmniHooks
5
+ module Strategies
6
+ class Weebly
7
+ include OmniHooks::Strategy
8
+ option :name, 'weebly'
9
+
10
+ event do
11
+ raw_info
12
+ end
13
+
14
+ event_type do
15
+ raw_info['event']
16
+ end
17
+
18
+ private
19
+
20
+ def raw_info
21
+ @raw_info ||= MultiJson.decode(request.body)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ module Omnihooks
2
+ module Weebly
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'omnihooks/strategies/weebly'
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omnihooks-weebly/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omnihooks-weebly"
8
+ spec.version = Omnihooks::Weebly::VERSION
9
+ spec.authors = ["Karl Falconer"]
10
+ spec.email = ["karl@getdropstream.com"]
11
+ spec.summary = %q{OmniHooks strategy for Weebly}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency 'omnihooks', '~> 0.0.1'
21
+ spec.add_dependency 'multi_json', '~> 1.11.2'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency 'rspec', '~> 3.3.0'
26
+ end
@@ -0,0 +1,14 @@
1
+ {
2
+ "client_id":"108104XXXX",
3
+ "client_version":"1.0.0",
4
+ "event":"store.order.pay",
5
+ "timestamp":1440016771,
6
+ "data": {
7
+ "user_id":"5530XXXX",
8
+ "site_id":"373917798919XXXXX",
9
+ "order_id":"1826571643",
10
+ "order_billing_id":1,
11
+ "order_billing_transaction_id":1
12
+ },
13
+ "hmac":"XXXXXXXX"
14
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "client_id":"108104XXXX",
3
+ "client_version":"1.0.0",
4
+ "event":"app.uninstall",
5
+ "timestamp":1440016771,
6
+ "data": {
7
+ "user_id":"5530XXXX",
8
+ "site_id":"373917798919XXXXX"
9
+ },
10
+ "hmac":"XXXXXXXX"
11
+ }
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ def make_env(path = '/hooks/weebly', props = {})
4
+ {
5
+ 'REQUEST_METHOD' => 'POST',
6
+ 'PATH_INFO' => path,
7
+ 'rack.session' => {},
8
+ 'rack.input' => StringIO.new('test=true'),
9
+ }.merge(props)
10
+ end
11
+
12
+ def read_request(file_name)
13
+ File.open(File.expand_path("../../../fixtures/#{file_name}.json", __FILE__)).read
14
+ end
15
+
16
+ RSpec.describe OmniHooks::Strategies::Weebly do
17
+ let(:app) do
18
+ lambda { |_env| [404, {}, ['Awesome']] }
19
+ end
20
+
21
+
22
+ describe '#options' do
23
+ subject { OmniHooks::Strategies::Weebly.new(nil) }
24
+
25
+ it 'should have a name defined' do
26
+ expect(subject.options.name).to eq('weebly')
27
+ end
28
+ end
29
+
30
+ describe '#args' do
31
+ it 'has expected arguments' do
32
+ expect(OmniHooks::Strategies::Weebly.args).to eq([:consumer_secret])
33
+ end
34
+ end
35
+
36
+ describe '#call' do
37
+ let(:subscriber) { Proc.new { nil } }
38
+ let(:strategy) { OmniHooks::Strategies::Weebly.new(app) }
39
+
40
+ before(:each) do
41
+ OmniHooks::Strategies::Weebly.configure do |events|
42
+ events.subscribe('store.order.pay', subscriber)
43
+ end
44
+ end
45
+
46
+ context 'with a matched event' do
47
+ it 'should pass the event to the subscriber' do
48
+ expect(subscriber).to receive(:call).with(a_hash_including('client_id', 'client_version', 'event', 'timestamp', 'data', 'hmac'))
49
+
50
+ strategy.call(make_env('/hooks/weebly', {'rack.input' => StringIO.new(read_request('matching_event')) }))
51
+ end
52
+ end
53
+
54
+ context 'with an unmatched event' do
55
+ it 'should pass the event to the subscriber' do
56
+ expect(subscriber).not_to receive(:call)
57
+
58
+ strategy.call(make_env('/hooks/weebly', {'rack.input' => StringIO.new(read_request('unmatching_event')) }))
59
+ end
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,100 @@
1
+ require 'rspec'
2
+ require 'omnihooks-weebly'
3
+
4
+
5
+ # This file was generated by the `rspec --init` command. Conventionally, all
6
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
8
+ # this file to always be loaded, without a need to explicitly require it in any
9
+ # files.
10
+ #
11
+ # Given that it is always loaded, you are encouraged to keep this file as
12
+ # light-weight as possible. Requiring heavyweight dependencies from this file
13
+ # will add to the boot time of your test suite on EVERY test run, even for an
14
+ # individual file that may not need all of that loaded. Instead, consider making
15
+ # a separate helper file that requires the additional dependencies and performs
16
+ # the additional setup, and require it from the spec files that actually need
17
+ # it.
18
+ #
19
+ # The `.rspec` file also contains a few flags that are not defaults but that
20
+ # users commonly want.
21
+ #
22
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
23
+ RSpec.configure do |config|
24
+ # rspec-expectations config goes here. You can use an alternate
25
+ # assertion/expectation library such as wrong or the stdlib/minitest
26
+ # assertions if you prefer.
27
+ config.expect_with :rspec do |expectations|
28
+ # This option will default to `true` in RSpec 4. It makes the `description`
29
+ # and `failure_message` of custom matchers include text for helper methods
30
+ # defined using `chain`, e.g.:
31
+ # be_bigger_than(2).and_smaller_than(4).description
32
+ # # => "be bigger than 2 and smaller than 4"
33
+ # ...rather than:
34
+ # # => "be bigger than 2"
35
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
36
+ end
37
+
38
+ # rspec-mocks config goes here. You can use an alternate test double
39
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
40
+ config.mock_with :rspec do |mocks|
41
+ # Prevents you from mocking or stubbing a method that does not exist on
42
+ # a real object. This is generally recommended, and will default to
43
+ # `true` in RSpec 4.
44
+ mocks.verify_partial_doubles = true
45
+ end
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+
50
+ # These two settings work together to allow you to limit a spec run
51
+ # to individual examples or groups you care about by tagging them with
52
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
53
+ # get run.
54
+ config.filter_run :focus
55
+ config.run_all_when_everything_filtered = true
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = 'doc'
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+
100
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omnihooks-weebly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Karl Falconer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omnihooks
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.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.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: multi_json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.11.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.11.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 3.3.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 3.3.0
83
+ description:
84
+ email:
85
+ - karl@getdropstream.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - .rspec
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - lib/omnihooks-weebly.rb
97
+ - lib/omnihooks-weebly/version.rb
98
+ - lib/omnihooks/strategies/weebly.rb
99
+ - omnihooks-weebly.gemspec
100
+ - spec/fixtures/matching_event.json
101
+ - spec/fixtures/unmatching_event.json
102
+ - spec/omnihooks/strategies/weebly_spec.rb
103
+ - spec/spec_helper.rb
104
+ homepage: ''
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.4.5
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: OmniHooks strategy for Weebly
128
+ test_files:
129
+ - spec/fixtures/matching_event.json
130
+ - spec/fixtures/unmatching_event.json
131
+ - spec/omnihooks/strategies/weebly_spec.rb
132
+ - spec/spec_helper.rb