j7w1 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aa16f84153486f2d40ab5806b51656e35e914e9
4
- data.tar.gz: 3c26a01d9f6eaa343592709edfeb35b3c5a0c469
3
+ metadata.gz: dd7bf02bf7f31fdbbfbf6bd4df8c0ae973aa34f5
4
+ data.tar.gz: 5e174eecc3cacaa92069d711e9c9ed90734c20df
5
5
  SHA512:
6
- metadata.gz: de214ef7b05d91fc18494403906ce3b0653bbb33c0ce88b6292795199a41df99a33a8cb2535e1171fa7bdcf9a0b7cf3ca5908d10ef5721fff6c292ea70f315c2
7
- data.tar.gz: ddea72235386072cf3642b577865146f101c60133df8467e95d6da633ae9cab94e819e0646596b22355b6118c246df472b8190109fe424644a576f83ae93193b
6
+ metadata.gz: 9e01923d701f151179037030225e262cb83dc6a7a0fe39f83d8e402a8cc4b498567eae396c98c7e838210cab271b5e9a42f7ca2331e22e4da1a88c6d2252a6be
7
+ data.tar.gz: 0b2ba4533938b3b3a747bd7e94eab11889e495352d6cce691162dba24e76ffac2c834f626f20af09f3b03332639788296daa80d4b788d6467079782e2564b146
data/j7w1.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = `git ls-files Gemfile LICENSE.txt README.md j7w1.gemspec lib spec`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
File without changes
@@ -4,6 +4,25 @@ module J7W1
4
4
  AWS::SNS.new J7W1.configuration.account
5
5
  end
6
6
 
7
+ def create_ios_application(name, certs, private_key, options)
8
+ sandbox = !(options[:sandbox] == false)
9
+ configuration = options[:sns_configuration] || J7W1.configuration
10
+
11
+ private_key = content_from private_key
12
+ certs = content_from certs
13
+
14
+ sns_client = options[:sns_client] || create_sns_client(configuration)
15
+
16
+ application_endpoint =
17
+ sns_client.client.create_platform_application name: name,
18
+ platform: (sandbox ? 'APNS_SANDBOX' : 'APNS'),
19
+ attributes: {
20
+ 'PlatformCredential' => private_key,
21
+ 'PlatformPrincipal' => certs,
22
+ }
23
+ application_endpoint[:platform_application_arn]
24
+ end
25
+
7
26
  def create_device_endpoint(device_identifier, platform, options = {})
8
27
  custom_user_data = options[:custom_user_data]
9
28
  sns_configuration = options[:sns_configuration]
@@ -77,7 +96,16 @@ module J7W1
77
96
  # TODO Android Push Implementation
78
97
  end
79
98
 
80
- module_function :create_sns_client, :create_device_endpoint, :push,
81
- :payload_for, :ios_payload_for, :android_payload_for
99
+ def content_from(argument)
100
+ case argument
101
+ when IO
102
+ argument.read
103
+ when String
104
+ argument
105
+ end
106
+ end
107
+
108
+ module_function :create_sns_client, :create_ios_application, :create_device_endpoint, :push,
109
+ :payload_for, :ios_payload_for, :android_payload_for, :content_from
82
110
  end
83
111
  end
data/lib/j7_w1/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module J7W1
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -4,4 +4,4 @@ app_endpoint:
4
4
  account:
5
5
  access_key_id: "<Your Access Key>"
6
6
  secret_access_key: "<Your Secret Key>"
7
- region: '<Your Region>'
7
+ region: '<Your Region, such as "ap-northeast-1">'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: j7w1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - condor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-10 00:00:00.000000000 Z
11
+ date: 2013-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -73,11 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
76
  - Gemfile
78
77
  - LICENSE.txt
79
78
  - README.md
80
- - Rakefile
81
79
  - j7w1.gemspec
82
80
  - lib/generators/j7_w1/migration/migration_generator.rb
83
81
  - lib/generators/j7_w1/migration/templates/active_record/migration.rb
@@ -88,8 +86,8 @@ files:
88
86
  - lib/j7_w1/active_record_ext.rb
89
87
  - lib/j7_w1/concrete.rb
90
88
  - lib/j7_w1/configuration.rb
89
+ - lib/j7_w1/mock.rb
91
90
  - lib/j7_w1/push_client.rb
92
- - lib/j7_w1/stub.rb
93
91
  - lib/j7_w1/version.rb
94
92
  - lib/j7w1.rb
95
93
  - spec/.gitignore
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"