j7w1 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/j7w1.gemspec +1 -1
- data/lib/j7w1.rb +8 -9
- data/lib/{j7_w1 → j7w1}/active_record_ext.rb +4 -4
- data/lib/{j7_w1 → j7w1}/configuration.rb +0 -0
- data/lib/j7w1/mock.rb +14 -0
- data/lib/{j7_w1 → j7w1}/push_client.rb +7 -6
- data/lib/{j7_w1 → j7w1}/util.rb +0 -0
- data/lib/j7w1/version.rb +3 -0
- metadata +7 -8
- data/lib/j7_w1/concrete.rb +0 -2
- data/lib/j7_w1/mock.rb +0 -46
- data/lib/j7_w1/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cedb14f45651df7c388739fec42fabaf81f3ff25
|
4
|
+
data.tar.gz: 887da73b3d84100cdd35349d3535e2d8de9818af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280af413f3b244033571099deffac8cd74b7baee11cf442189790340fa9d7d8147146df876ecd9aacc8e3c1c0a6e08c0798a4b951021bde84b7e286d4a68054a
|
7
|
+
data.tar.gz: ed6bec0277cc55ba920b642e52328b566b142dbd6d4a2ae8b4be9361ea2188927824623aee119847887db12ed867a9c06f55b50675fd20f20acdaa9af8f1b357
|
data/j7w1.gemspec
CHANGED
data/lib/j7w1.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
module J7W1
|
4
|
-
autoload :Configuration, '
|
5
|
-
autoload :Util, '
|
4
|
+
autoload :Configuration, 'j7w1/configuration'
|
5
|
+
autoload :Util, 'j7w1/util'
|
6
|
+
autoload :Version, 'j7w1/version'
|
7
|
+
autoload :ActiveRecordExt, 'j7w1/active_record_ext'
|
8
|
+
|
9
|
+
ActiveRecord::Base.__send__(:include, ActiveRecordExt) if defined? ActiveRecord::Base
|
6
10
|
|
7
11
|
class << self
|
8
12
|
attr_reader :current_strategy
|
@@ -15,11 +19,11 @@ module J7W1
|
|
15
19
|
|
16
20
|
configuration = configuration_values_of(configuration)
|
17
21
|
if configuration[:mock]
|
18
|
-
|
22
|
+
autoload :PushClient, 'j7w1/mock'
|
19
23
|
return
|
20
24
|
end
|
21
25
|
|
22
|
-
|
26
|
+
autoload :PushClient, 'j7w1/push_client'
|
23
27
|
@configuration = Configuration.new configuration
|
24
28
|
end
|
25
29
|
|
@@ -87,8 +91,3 @@ module J7W1
|
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
90
|
-
|
91
|
-
if defined? ActiveRecord
|
92
|
-
require 'j7_w1/active_record_ext'
|
93
|
-
ActiveRecord::Base.__send__ :include, J7W1::ActiveRecordExt
|
94
|
-
end
|
@@ -9,7 +9,8 @@ module J7W1
|
|
9
9
|
def application_device_owner
|
10
10
|
include InstanceMethods
|
11
11
|
|
12
|
-
has_many :application_devices, class_name: 'J7W1ApplicationDevice'
|
12
|
+
has_many :application_devices, class_name: 'J7W1ApplicationDevice',
|
13
|
+
as: :owner
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -29,9 +30,8 @@ module J7W1
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def push!(options = {})
|
32
|
-
|
33
|
-
|
34
|
-
device.push! options.tap{|o|o.merge! sns_client: sns_client}
|
33
|
+
application_devices.each do |device|
|
34
|
+
device.push! options
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
File without changes
|
data/lib/j7w1/mock.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module J7W1
|
2
|
+
module PushClient
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def push_histories
|
6
|
+
@push_histories ||= []
|
7
|
+
end
|
8
|
+
|
9
|
+
def push(endpoint_arn, platform, options)
|
10
|
+
@push_histories.push(options.merge(device: {platform: platform, endpoint_arn: endpoint_arn}))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -14,12 +14,13 @@ module J7W1
|
|
14
14
|
sns_client = options[:sns_client] || create_sns_client(configuration)
|
15
15
|
|
16
16
|
application_endpoint =
|
17
|
-
sns_client.client.create_platform_application
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
sns_client.client.create_platform_application(
|
18
|
+
name: name, platform: (sandbox ? 'APNS_SANDBOX' : 'APNS'),
|
19
|
+
attributes: {
|
20
|
+
'PlatformCredential' => private_key,
|
21
|
+
'PlatformPrincipal' => certs,
|
22
|
+
}
|
23
|
+
)
|
23
24
|
application_endpoint[:platform_application_arn]
|
24
25
|
end
|
25
26
|
|
data/lib/{j7_w1 → j7w1}/util.rb
RENAMED
File without changes
|
data/lib/j7w1/version.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: j7w1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- condor
|
@@ -83,14 +83,13 @@ files:
|
|
83
83
|
- lib/generators/j7_w1/model/templates/j7_w1_application_device.rb.erb
|
84
84
|
- lib/generators/j7_w1/model/templates/j7_w1_create_endpoint_worker.rb
|
85
85
|
- lib/generators/j7_w1/model/templates/j7_w1_destroy_endpoint_worker.rb
|
86
|
-
- lib/j7_w1/active_record_ext.rb
|
87
|
-
- lib/j7_w1/concrete.rb
|
88
|
-
- lib/j7_w1/configuration.rb
|
89
|
-
- lib/j7_w1/mock.rb
|
90
|
-
- lib/j7_w1/push_client.rb
|
91
|
-
- lib/j7_w1/util.rb
|
92
|
-
- lib/j7_w1/version.rb
|
93
86
|
- lib/j7w1.rb
|
87
|
+
- lib/j7w1/active_record_ext.rb
|
88
|
+
- lib/j7w1/configuration.rb
|
89
|
+
- lib/j7w1/mock.rb
|
90
|
+
- lib/j7w1/push_client.rb
|
91
|
+
- lib/j7w1/util.rb
|
92
|
+
- lib/j7w1/version.rb
|
94
93
|
- spec/.gitignore
|
95
94
|
- spec/config.example.yml
|
96
95
|
homepage: ''
|
data/lib/j7_w1/concrete.rb
DELETED
data/lib/j7_w1/mock.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module J7W1
|
2
|
-
module PushClient
|
3
|
-
|
4
|
-
class << self
|
5
|
-
def push_histories
|
6
|
-
@push_histories ||= []
|
7
|
-
end
|
8
|
-
|
9
|
-
def push(device, options)
|
10
|
-
@push_histories.push(options.merge(device: device))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
module ActiveRecordExt
|
16
|
-
def self.included(base)
|
17
|
-
base.extend ClassMethods
|
18
|
-
end
|
19
|
-
|
20
|
-
module ClassMethods
|
21
|
-
def device_owner_classes
|
22
|
-
require 'set'
|
23
|
-
@device_owner_classes ||= Set.new
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
def device_owner
|
28
|
-
device_owner_classes << self
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
module InstanceMethods
|
33
|
-
def push!(options = {})
|
34
|
-
aplication_devices.each do |device|
|
35
|
-
J7W1::PushClient.push device, options
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def add_device(device_identifier, platform)
|
40
|
-
end
|
41
|
-
|
42
|
-
def remove_device(device_identifier, platform)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/j7_w1/version.rb
DELETED