moromi-apns-aws_sns_adapter 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +30 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/circle.yml +4 -0
- data/lib/moromi/apns/aws_sns_adapter.rb +18 -0
- data/lib/moromi/apns/aws_sns_adapter/apns_extension.rb +20 -0
- data/lib/moromi/apns/aws_sns_adapter/aws_sns_extension.rb +9 -0
- data/lib/moromi/apns/aws_sns_adapter/config.rb +14 -0
- data/lib/moromi/apns/aws_sns_adapter/version.rb +7 -0
- data/moromi-apns-aws_sns_adapter.gemspec +29 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5e4720f19e973e8de1bef3af5dc581addc1c8bc9
|
4
|
+
data.tar.gz: 67d3bc57e9aeb7a8a75513009dea51528217c45c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b6169af8bdfa7c5456fb01ffae8411389f666a6570aa829c4755fc6a1d67094d36c3bc4aebb66e668bf021741bcae7c55e5f42b64be509b3257a72ef596abad3
|
7
|
+
data.tar.gz: a40099cd5c1b33a1b03bb93e9d0482728117c6b9d07cf2b19b4eccd125a2143ac74179b4c225b6925970afcf0e5c1693556f836b318d9b73f2c8b3d226aa725c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 moromi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Moromi::Apns::AwsSnsAdapter
|
2
|
+
|
3
|
+
extension for moromi-apns and moromi-aws-sns
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'moromi-apns-aws_sns_adapter'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install moromi-apns-aws_sns_adapter
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
+
|
25
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/moromi/moromi-apns-aws_sns_adapter.
|
30
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "moromi/apns/aws_sns_adapter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/circle.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'moromi/apns/aws_sns_adapter/version'
|
2
|
+
require 'moromi/apns/aws_sns_adapter/config'
|
3
|
+
require 'moromi/apns/aws_sns_adapter/apns_extension'
|
4
|
+
require 'moromi/apns/aws_sns_adapter/aws_sns_extension'
|
5
|
+
|
6
|
+
module Moromi
|
7
|
+
module Apns
|
8
|
+
module AwsSnsAdapter
|
9
|
+
def self.configure(&block)
|
10
|
+
yield @config ||= Config.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.config
|
14
|
+
@config
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Moromi::Apns::Message::Base
|
2
|
+
def to_aws_sns_params
|
3
|
+
base = {
|
4
|
+
aps: {
|
5
|
+
badge: badge,
|
6
|
+
alert: alert,
|
7
|
+
sound: sound,
|
8
|
+
'content-available' => content_available,
|
9
|
+
priority: priority
|
10
|
+
}
|
11
|
+
}
|
12
|
+
custom_data.merge(base)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Moromi::Apns::Environment::Base
|
17
|
+
def aws_sns_application_arn
|
18
|
+
@aws_sns_application_arn ||= Moromi::Apns::AwsSnsAdapter.config.aws_sns_application_arns[key]
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Moromi::Aws::Sns::Client
|
2
|
+
def send_apns_message(arn:, message:, sandbox: true)
|
3
|
+
send_apns(arn: arn, params: message.to_aws_sns_params, sandbox: sandbox)
|
4
|
+
end
|
5
|
+
|
6
|
+
def send_apns_message_to_topic(topic_arn:, message:, sandbox: true)
|
7
|
+
send_apns_to_topic(topic_arn: topic_arn, params: message.to_aws_sns_params, sandbox: sandbox)
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'active_support/configurable'
|
2
|
+
|
3
|
+
module Moromi
|
4
|
+
module Apns
|
5
|
+
module AwsSnsAdapter
|
6
|
+
class Config
|
7
|
+
include ActiveSupport::Configurable
|
8
|
+
|
9
|
+
config_accessor :aws_sns_application_arns
|
10
|
+
config_accessor :application_arn_builder_class
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'moromi/apns/aws_sns_adapter/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "moromi-apns-aws_sns_adapter"
|
8
|
+
spec.version = Moromi::Apns::AwsSnsAdapter::VERSION
|
9
|
+
spec.authors = ["Takahiro Ooishi"]
|
10
|
+
spec.email = ["taka0125@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{adapter for moromi-apns, moromi-aws-sns}
|
13
|
+
spec.description = %q{adapter for moromi-apns, moromi-aws-sns}
|
14
|
+
spec.homepage = "https://github.com/moromi/moromi-apns-aws_sns_adapter"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'activesupport', ['>= 4.2']
|
23
|
+
spec.add_dependency 'moromi-apns', '< 1.0'
|
24
|
+
spec.add_dependency 'moromi-aws-sns', '< 1.0'
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moromi-apns-aws_sns_adapter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takahiro Ooishi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: moromi-apns
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "<"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: moromi-aws-sns
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "<"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
description: adapter for moromi-apns, moromi-aws-sns
|
98
|
+
email:
|
99
|
+
- taka0125@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- bin/console
|
111
|
+
- bin/setup
|
112
|
+
- circle.yml
|
113
|
+
- lib/moromi/apns/aws_sns_adapter.rb
|
114
|
+
- lib/moromi/apns/aws_sns_adapter/apns_extension.rb
|
115
|
+
- lib/moromi/apns/aws_sns_adapter/aws_sns_extension.rb
|
116
|
+
- lib/moromi/apns/aws_sns_adapter/config.rb
|
117
|
+
- lib/moromi/apns/aws_sns_adapter/version.rb
|
118
|
+
- moromi-apns-aws_sns_adapter.gemspec
|
119
|
+
homepage: https://github.com/moromi/moromi-apns-aws_sns_adapter
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.5.1
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: adapter for moromi-apns, moromi-aws-sns
|
143
|
+
test_files: []
|