pushme-aws 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 +13 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +29 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/generators/pushme/install_generator.rb +48 -0
- data/lib/generators/pushme/templates/add_devices.rb +5 -0
- data/lib/pushme/aws.rb +110 -0
- data/lib/pushme/aws/version.rb +5 -0
- data/pushme-aws.gemspec +30 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f734ba5cf18fd11aa9647e75ea1b5227d83157a4
|
4
|
+
data.tar.gz: 0a8c6e8cb34963dee445eb3ef3b1cc43e34f70e1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e8e91df8cbd07f9a056fe38c2127872ce1a6c134c8a023fc96cc2031fb952f4249cd9504f5a5f7cd0d7c5b214196294e1cd5331a3aaac92dca7f922a0d3a4aab
|
7
|
+
data.tar.gz: 96df8e56c81b3a5e746229c9c8898b456356e842e86e6028c1c9a2c19e55acb2b12e628352eb7ad091446cb8e11f758894e83f6aa0a2a129401ab1a668373433
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Agustin Cavilliotti
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Pushme::Aws
|
2
|
+
|
3
|
+
|
4
|
+
#### :warning: IMPORTANT! This gem is in an very early stage, a lot of the features or logic in it is going to be change a lot in the next iterations
|
5
|
+
|
6
|
+
Add some basic features to deal with push notifications through [AWS SNS Mobile Push Notification Service](https://docs.aws.amazon.com/sns/latest/dg/SNSMobilePush.html) using AWS SDK v2.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'pushme-aws'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install pushme-aws
|
23
|
+
|
24
|
+
## Setup
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
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.
|
31
|
+
|
32
|
+
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).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nilusorg/pushme-aws.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
task :console do
|
9
|
+
require "pry"
|
10
|
+
require "./lib/pushme/aws"
|
11
|
+
require "httplog"
|
12
|
+
HttpLog.configure do |config|
|
13
|
+
config.log_headers = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def reload!
|
17
|
+
files = $LOADED_FEATURES.select { |feat| feat =~ %r{lib/pushme} }
|
18
|
+
# Deactivate warning messages.
|
19
|
+
original_verbose, $VERBOSE = $VERBOSE, nil
|
20
|
+
files.each { |file| load file }
|
21
|
+
# Activate warning messages again.
|
22
|
+
$VERBOSE = original_verbose
|
23
|
+
init_setup
|
24
|
+
"Console reloaded!"
|
25
|
+
end
|
26
|
+
|
27
|
+
ARGV.clear
|
28
|
+
Pry.start
|
29
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pushme/aws"
|
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(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
|
5
|
+
module Pushme
|
6
|
+
module Generators
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
include Rails::Generators::Migration
|
9
|
+
|
10
|
+
source_root File.expand_path('./../templates', __FILE__)
|
11
|
+
|
12
|
+
desc "This generator creates the migration file required to add the attribute
|
13
|
+
device_tokens to the given table"
|
14
|
+
|
15
|
+
def copy_migration
|
16
|
+
file_name = 'add_devices'
|
17
|
+
migration_name = "#{file_name}_to_#{table_name}.rb"
|
18
|
+
if self.class.migration_exists?('db/migrate', migration_name)
|
19
|
+
say_status('skipped', "Migration #{migration_name} already exists")
|
20
|
+
else
|
21
|
+
migration_template "#{file_name}.rb",
|
22
|
+
"db/migrate/#{migration_name}",
|
23
|
+
migration_version: migration_version,
|
24
|
+
table_name: table_name
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Implement the required interface for Rails::Generators::Migration
|
29
|
+
def self.next_migration_number(_path)
|
30
|
+
Time.now.utc.strftime('%Y%m%d%H%M%S')
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def rails5?
|
36
|
+
Rails.version.start_with? '5'
|
37
|
+
end
|
38
|
+
|
39
|
+
def migration_version
|
40
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if rails5?
|
41
|
+
end
|
42
|
+
|
43
|
+
def table_name
|
44
|
+
@table_name ||= Pushme.table_name
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/pushme/aws.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'aws-sdk-sns'
|
2
|
+
|
3
|
+
require 'pushme/aws/version'
|
4
|
+
|
5
|
+
module Pushme
|
6
|
+
VALID_DEVICE_TYPES = %i(
|
7
|
+
android
|
8
|
+
ios
|
9
|
+
).freeze
|
10
|
+
private_constant :VALID_DEVICE_TYPES
|
11
|
+
|
12
|
+
@config = {
|
13
|
+
device_types: VALID_DEVICE_TYPES
|
14
|
+
}
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def setup
|
18
|
+
yield self
|
19
|
+
end
|
20
|
+
|
21
|
+
def device_types=(types)
|
22
|
+
raise ArgumentError, 'Argument must be an array of symbols' unless types.is_a?(Array)
|
23
|
+
|
24
|
+
types.each do |type|
|
25
|
+
raise ArgumentError, "Invalid type #{type}. The valid options are #{VALID_DEVICE_TYPES.join(', ')}" unless VALID_DEVICE_TYPES.include?(type)
|
26
|
+
end
|
27
|
+
|
28
|
+
@config[:device_types] = types
|
29
|
+
end
|
30
|
+
|
31
|
+
def table_name=(table_name)
|
32
|
+
raise ArgumentError, 'Argument must be a string' unless table_name.is_a?(String)
|
33
|
+
|
34
|
+
@config[:table_name] = table_name.to_sym
|
35
|
+
end
|
36
|
+
|
37
|
+
def config
|
38
|
+
@config
|
39
|
+
end
|
40
|
+
|
41
|
+
def device_types
|
42
|
+
@config[:device_types]
|
43
|
+
end
|
44
|
+
|
45
|
+
def table_name
|
46
|
+
@config[:table_name]
|
47
|
+
end
|
48
|
+
|
49
|
+
def valid_device_types
|
50
|
+
VALID_DEVICE_TYPES
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
module Aws
|
55
|
+
@config = {
|
56
|
+
arn: {}
|
57
|
+
}
|
58
|
+
|
59
|
+
class << self
|
60
|
+
|
61
|
+
def setup
|
62
|
+
yield self
|
63
|
+
end
|
64
|
+
|
65
|
+
def android_arn=(android_arn)
|
66
|
+
raise ArgumentError, 'Argument must be a string' unless android_arn.is_a?(String)
|
67
|
+
|
68
|
+
@config[:arn][:android] = android_arn
|
69
|
+
end
|
70
|
+
|
71
|
+
def ios_arn=(ios_arn)
|
72
|
+
raise ArgumentError, 'Argument must be a string' unless ios_arn.is_a?(String)
|
73
|
+
|
74
|
+
@config[:arn][:ios] = ios_arn
|
75
|
+
end
|
76
|
+
|
77
|
+
def ios_sandbox=(ios_sandbox)
|
78
|
+
raise ArgumentError, 'Argument must be a boolean' unless ios_sandbox.is_a?(TrueClass) || ios_sandbox.is_a?(FalseClass)
|
79
|
+
|
80
|
+
@config[:ios_sandbox] = ios_sandbox
|
81
|
+
end
|
82
|
+
|
83
|
+
def region=(region)
|
84
|
+
raise ArgumentError, 'Argument must be a string' unless region.is_a?(String)
|
85
|
+
|
86
|
+
@config[:region] = region
|
87
|
+
end
|
88
|
+
|
89
|
+
def config
|
90
|
+
@config
|
91
|
+
end
|
92
|
+
|
93
|
+
def android_arn
|
94
|
+
@config[:arn][:android]
|
95
|
+
end
|
96
|
+
|
97
|
+
def ios_arn
|
98
|
+
@config[:arn][:ios]
|
99
|
+
end
|
100
|
+
|
101
|
+
def ios_sandbox
|
102
|
+
@config[:ios_sandbox] || false
|
103
|
+
end
|
104
|
+
|
105
|
+
def region
|
106
|
+
@config[:region]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/pushme-aws.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "pushme/aws/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "pushme-aws"
|
7
|
+
spec.version = Pushme::Aws::VERSION
|
8
|
+
spec.authors = ["Agustin Cavilliotti"]
|
9
|
+
spec.email = ["cavi21@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Push Notifications via Amazon AWS}
|
12
|
+
spec.description = %q{Add some basic feature to deal with push notifications through AWS SNS Mobile Push Notification Service}
|
13
|
+
spec.homepage = "https://github.com/nilusorg/pushme-aws"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "pry"
|
24
|
+
spec.add_development_dependency "httplog"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
|
29
|
+
spec.add_dependency "aws-sdk-sns", ["~> 1"]
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pushme-aws
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Agustin Cavilliotti
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httplog
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
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.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
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.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.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk-sns
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1'
|
97
|
+
description: Add some basic feature to deal with push notifications through AWS SNS
|
98
|
+
Mobile Push Notification Service
|
99
|
+
email:
|
100
|
+
- cavi21@gmail.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- lib/generators/pushme/install_generator.rb
|
115
|
+
- lib/generators/pushme/templates/add_devices.rb
|
116
|
+
- lib/pushme/aws.rb
|
117
|
+
- lib/pushme/aws/version.rb
|
118
|
+
- pushme-aws.gemspec
|
119
|
+
homepage: https://github.com/nilusorg/pushme-aws
|
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.6.11
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Push Notifications via Amazon AWS
|
143
|
+
test_files: []
|