parsecom-notifier 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.
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/bin/parsecom-notify +33 -0
- data/parsecom-notifier.gemspec +21 -0
- metadata +70 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 ANDO Yasushi
|
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,39 @@
|
|
1
|
+
# parsecom-notifier
|
2
|
+
|
3
|
+
You can register many pushes at once.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install parsecom-notifier
|
8
|
+
|
9
|
+
If you are using rbenv, please don't forget call rehash
|
10
|
+
|
11
|
+
$ rbenv rehash
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Set environment variables to connect parse.com
|
16
|
+
|
17
|
+
export PARSE_APPLICATION_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
18
|
+
export PARSE_API_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
19
|
+
export PARSE_MASTER_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
20
|
+
|
21
|
+
Create a file describing about pushes in yaml format. For instance:
|
22
|
+
|
23
|
+
message: Hello from parsecom-notifier
|
24
|
+
pushes:
|
25
|
+
-
|
26
|
+
at: 2014-12-02T15:00:00+09:00
|
27
|
+
conditions:
|
28
|
+
createdAt:
|
29
|
+
from: 2014-10-01T00:00:00Z
|
30
|
+
-
|
31
|
+
at: 2014-12-02T15:20:00+09:00
|
32
|
+
conditions:
|
33
|
+
createdAt:
|
34
|
+
from: 2014-07-18T10:51:00Z
|
35
|
+
to: 2014-09-30T23:59:59Z
|
36
|
+
|
37
|
+
Call parsecom-notify command with the file.
|
38
|
+
|
39
|
+
$ parsecom-notify pushes.yaml
|
data/Rakefile
ADDED
data/bin/parsecom-notify
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'parsecom'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
settings = YAML.load_file ARGF
|
6
|
+
|
7
|
+
def iso8601 time
|
8
|
+
time.is_a?(Time) ? time.iso8601 : time
|
9
|
+
end
|
10
|
+
|
11
|
+
settings['pushes'].each do |setting|
|
12
|
+
message = setting['message'] || settings['message']
|
13
|
+
at = iso8601 setting['at']
|
14
|
+
condition = setting['condition'] || setting['conditions']
|
15
|
+
|
16
|
+
Parse::Push.send message, at: at, condition: proc {
|
17
|
+
condition.each do |key, val|
|
18
|
+
col = column key
|
19
|
+
val = {eq: val} unless val.is_a? Hash
|
20
|
+
if key =~ /At$/
|
21
|
+
val.each do |cond, v|
|
22
|
+
cond = :gte if cond == 'from'
|
23
|
+
cond = :lte if cond == 'to'
|
24
|
+
col.send cond, Parse::ParseDate.parse(iso8601(v))
|
25
|
+
end
|
26
|
+
else
|
27
|
+
val.each do |cond, v|
|
28
|
+
col.send cond, v
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
}
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "parsecom-notifier"
|
7
|
+
spec.version = '0.0'
|
8
|
+
spec.authors = ["ANDO Yasushi"]
|
9
|
+
spec.email = ["andyjpn@gmail.com"]
|
10
|
+
spec.summary = %q{Register Pushes}
|
11
|
+
spec.description = %q{Register Pushes}
|
12
|
+
spec.homepage = "https://github.com/technohippy/parsecom-notifier"
|
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 "parsecom", ">=0.7.0"
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: parsecom-notifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.0'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- ANDO Yasushi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: parsecom
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.7.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.7.0
|
30
|
+
description: Register Pushes
|
31
|
+
email:
|
32
|
+
- andyjpn@gmail.com
|
33
|
+
executables:
|
34
|
+
- parsecom-notify
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/parsecom-notify
|
44
|
+
- parsecom-notifier.gemspec
|
45
|
+
homepage: https://github.com/technohippy/parsecom-notifier
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.8.23
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Register Pushes
|
70
|
+
test_files: []
|