aws_sns_manager 0.0.1.pre.alpha.pre.16

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
+ NGFkOTM3OGMyOTk0NjVmMjUyNzU5ODNjZGU5OWU5MzEyMTQ3OTQzNA==
5
+ data.tar.gz: !binary |-
6
+ ODEzZTY4OTZmNTY5Yjk5ODk3ZjAwODhiYjAzMzU5MGM1OWM1MTFjMA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzgyMzU0YzU0NDI1YTk2ZDljYmZjZDg2NDRiMmUwNTJjYWU5ZDliOTc5ZDJh
10
+ MThkZTIwNDNkY2RkODMyOWM1YWU3YmM2OTliZmY4Y2JiNjQxOTQ0YWUyNWRi
11
+ YzJlY2M3ZmM2ODYxZWE4NmViMTBjMDUyNGJmODk1ZjIxMTA2ZTk=
12
+ data.tar.gz: !binary |-
13
+ ZDY2ZTk3MTc3OWZmMGM3NzA4YjhhNjhjYWUzMDllNWQxYTNjMTQ0NzcwNzE2
14
+ NDJiZjUzNGQ2YjlmNTViNWYzMmMwOTljNmIxOWI4MzI1OTE4YjQ0ZmNkNGIw
15
+ YzUyZmI3MTY0YjNmZTQ1YzA5YzFmM2YyOTdkOWNhOGZhYWQxZmM=
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ coverage
data/.rubocop.yml ADDED
@@ -0,0 +1,7 @@
1
+ Lint/HandleExceptions:
2
+ Exclude:
3
+ - spec/aws_sns_manager/client_spec.rb
4
+
5
+ Metrics/LineLength:
6
+ Exclude:
7
+ - aws_sns_manager.gemspec
data/.travis.yml ADDED
@@ -0,0 +1,28 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem install bundler
4
+ - "rm ${BUNDLE_GEMFILE}.lock"
5
+ before_script:
6
+ - bundle update
7
+ cache: bundler
8
+ rvm:
9
+ - 2.0.0
10
+ - 2.1.0
11
+ - 2.1.1
12
+ - 2.1.2
13
+ - 2.1.3
14
+ - 2.1.4
15
+ - 2.1.5
16
+ - 2.2.0
17
+ - 2.2.1
18
+ deploy:
19
+ provider: rubygems
20
+ api_key:
21
+ secure: DaIvbW+6p9LNv3YrnsIDtwo4f/7pIe1Y1E5tQuoOspN+lnUhaL5qFWYtbyuMUW9yG9TQhPCn9irCbUBkoKLCKCcbtYrQsELY2hx+z3fFJ7wZMriLojCttf4yZfGdK539clcPsIpkWVSsDaUnxGC1nbj5pJBLJk4U23SiZrMWL0I=
22
+ gem: aws_sns_manager
23
+ on:
24
+ tags: true
25
+ repo: nafu/aws_sns_manager
26
+ addons:
27
+ code_climate:
28
+ repo_token: f963cfa99b5c830023926cbaa0cf70b2112d28cdc1b7db78bf39841936e4f766
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'codeclimate-test-reporter', group: :test, require: nil
data/Gemfile.lock ADDED
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ aws_sns_manager (0.0.1.pre.alpha.pre.16)
5
+ aws-sdk (~> 2)
6
+ bundler (>= 1.3.0, < 2.0)
7
+ json (~> 1.8)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ast (2.0.0)
13
+ astrolabe (1.3.0)
14
+ parser (>= 2.2.0.pre.3, < 3.0)
15
+ aws-sdk (2.0.39)
16
+ aws-sdk-resources (= 2.0.39)
17
+ aws-sdk-core (2.0.39)
18
+ builder (~> 3.0)
19
+ jmespath (~> 1.0)
20
+ multi_json (~> 1.0)
21
+ aws-sdk-resources (2.0.39)
22
+ aws-sdk-core (= 2.0.39)
23
+ builder (3.2.2)
24
+ codeclimate-test-reporter (0.4.7)
25
+ simplecov (>= 0.7.1, < 1.0.0)
26
+ diff-lcs (1.2.5)
27
+ docile (1.1.5)
28
+ jmespath (1.0.2)
29
+ multi_json (~> 1.0)
30
+ json (1.8.2)
31
+ multi_json (1.11.0)
32
+ parser (2.2.2.0)
33
+ ast (>= 1.1, < 3.0)
34
+ powerpack (0.1.0)
35
+ rainbow (2.0.0)
36
+ rake (10.4.2)
37
+ rspec (3.2.0)
38
+ rspec-core (~> 3.2.0)
39
+ rspec-expectations (~> 3.2.0)
40
+ rspec-mocks (~> 3.2.0)
41
+ rspec-core (3.2.3)
42
+ rspec-support (~> 3.2.0)
43
+ rspec-expectations (3.2.1)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.2.0)
46
+ rspec-mocks (3.2.1)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.2.0)
49
+ rspec-support (3.2.2)
50
+ rubocop (0.30.0)
51
+ astrolabe (~> 1.3)
52
+ parser (>= 2.2.0.1, < 3.0)
53
+ powerpack (~> 0.1)
54
+ rainbow (>= 1.99.1, < 3.0)
55
+ ruby-progressbar (~> 1.4)
56
+ ruby-progressbar (1.7.5)
57
+ simplecov (0.9.2)
58
+ docile (~> 1.1.0)
59
+ multi_json (~> 1.0)
60
+ simplecov-html (~> 0.9.0)
61
+ simplecov-html (0.9.0)
62
+
63
+ PLATFORMS
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ aws_sns_manager!
68
+ codeclimate-test-reporter
69
+ rake (~> 10.0)
70
+ rspec (~> 3)
71
+ rubocop (~> 0.30)
72
+ simplecov (~> 0.9)
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Fumiya Nakamura
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.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ [![Build Status](https://travis-ci.org/nafu/aws_sns_manager.svg?branch=master)](https://travis-ci.org/nafu/aws_sns_manager)
2
+ [![Code Climate](https://codeclimate.com/github/nafu/aws_sns_manager/badges/gpa.svg)](https://codeclimate.com/github/nafu/aws_sns_manager)
3
+ [![Test Coverage](https://codeclimate.com/github/nafu/aws_sns_manager/badges/coverage.svg)](https://codeclimate.com/github/nafu/aws_sns_manager)
4
+ [![Dependency Status](https://gemnasium.com/nafu/aws_sns_manager.svg)](https://gemnasium.com/nafu/aws_sns_manager)
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ task test: :spec
7
+
8
+ begin
9
+ require 'rubocop/rake_task'
10
+ RuboCop::RakeTask.new
11
+ rescue LoadError
12
+ task :rubocop do
13
+ $stderr.puts 'RuboCop is disabled'
14
+ end
15
+ end
16
+
17
+ task default: [:spec, :rubocop]
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aws_sns_manager/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.authors = ['Fumiya Nakamura']
8
+ s.description = 'Utility for Amazon Simple Notification Service'
9
+ s.email = ['nakamurafumiya003@gmail.com']
10
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?('spec/') }
11
+ s.homepage = 'http://github.com/nafu/aws_sns_manager'
12
+ s.licenses = %w(MIT)
13
+ s.name = 'aws_sns_manager'
14
+ s.require_paths = %w(lib)
15
+ s.required_rubygems_version = '>= 1.3.5'
16
+ s.summary = s.description
17
+ s.version = AwsSnsManager::VERSION
18
+ s.version = "#{s.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
19
+
20
+ s.required_ruby_version = '~> 2.0'
21
+
22
+ s.add_dependency 'bundler', '>= 1.3.0', '< 2.0'
23
+ s.add_dependency 'aws-sdk', '~> 2'
24
+ s.add_dependency 'json', '~> 1.8'
25
+
26
+ s.add_development_dependency 'rake', '~> 10.0'
27
+ s.add_development_dependency 'rspec', '~> 3'
28
+ s.add_development_dependency 'simplecov', '~> 0.9'
29
+ s.add_development_dependency 'rubocop', '~> 0.30'
30
+ end
@@ -0,0 +1,44 @@
1
+ module AwsSnsManager
2
+ # = AwsSnsManager::Client
3
+ class Client
4
+ attr_accessor :client
5
+ attr_accessor :arn
6
+
7
+ def initialize(options = {})
8
+ super()
9
+
10
+ @client = Aws::SNS::Client.new(options)
11
+ end
12
+
13
+ def send(text = nil)
14
+ message = message(text).to_json
15
+ response = publish_rescue(message)
16
+ !response.nil?
17
+ end
18
+
19
+ def publish_rescue(message)
20
+ client.publish(
21
+ target_arn: arn,
22
+ message: message,
23
+ message_structure: 'json'
24
+ )
25
+ end
26
+
27
+ def message(text)
28
+ {
29
+ APNS: notification(text).to_json
30
+ }
31
+ end
32
+
33
+ def notification(text)
34
+ {
35
+ aps: {
36
+ alert: text,
37
+ sound: 'default',
38
+ badge: 1,
39
+ 'content-available': 1
40
+ }
41
+ }
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,12 @@
1
+ module AwsSnsManager
2
+ # = AwsSnsManager::Config
3
+ module Config
4
+ @model = 'PushEndpoint'
5
+ class << self
6
+ # Configuration option to specify a model
7
+ # you want to use AwsSnsManager to work with.
8
+ # Default: PushEndpoint
9
+ attr_accessor :model
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ # = AwsSnsManager::VERSION
2
+ module AwsSnsManager
3
+ VERSION = '0.0.1'
4
+ end
@@ -0,0 +1,12 @@
1
+ require 'aws-sdk'
2
+ require 'json'
3
+
4
+ # = AwsSnsManager
5
+ module AwsSnsManager
6
+ autoload :Config, 'aws_sns_manager/config'
7
+ autoload :Client, 'aws_sns_manager/client'
8
+
9
+ def self.config(&block)
10
+ block.call(AwsSnsManager::Config) if block_given?
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws_sns_manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre.alpha.pre.16
5
+ platform: ruby
6
+ authors:
7
+ - Fumiya Nakamura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.3.0
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: aws-sdk
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '2'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '2'
47
+ - !ruby/object:Gem::Dependency
48
+ name: json
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.8'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '1.8'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: '10.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: '10.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '3'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '3'
89
+ - !ruby/object:Gem::Dependency
90
+ name: simplecov
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '0.9'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '0.9'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rubocop
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '0.30'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ~>
115
+ - !ruby/object:Gem::Version
116
+ version: '0.30'
117
+ description: Utility for Amazon Simple Notification Service
118
+ email:
119
+ - nakamurafumiya003@gmail.com
120
+ executables: []
121
+ extensions: []
122
+ extra_rdoc_files: []
123
+ files:
124
+ - .gitignore
125
+ - .rubocop.yml
126
+ - .travis.yml
127
+ - Gemfile
128
+ - Gemfile.lock
129
+ - LICENSE
130
+ - README.md
131
+ - Rakefile
132
+ - aws_sns_manager.gemspec
133
+ - lib/aws_sns_manager.rb
134
+ - lib/aws_sns_manager/client.rb
135
+ - lib/aws_sns_manager/config.rb
136
+ - lib/aws_sns_manager/version.rb
137
+ homepage: http://github.com/nafu/aws_sns_manager
138
+ licenses:
139
+ - MIT
140
+ metadata: {}
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: '2.0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ! '>'
153
+ - !ruby/object:Gem::Version
154
+ version: 1.3.1
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 2.4.5
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: Utility for Amazon Simple Notification Service
161
+ test_files: []