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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4fca563abd2f742a6f1d4e5e6464394822ef449
4
- data.tar.gz: 05c7520ab167a866d9b9bb88a34f88ed3464ba74
3
+ metadata.gz: cedb14f45651df7c388739fec42fabaf81f3ff25
4
+ data.tar.gz: 887da73b3d84100cdd35349d3535e2d8de9818af
5
5
  SHA512:
6
- metadata.gz: 1fc3a95a777c0ae8239cc646429397d73c3a6c3bd6ee3be7a3b6a73e3b837e9ecc3a89aedb3db4b8d9f21b3ac2bb332f5ff92fafc4fcd7793a525ce903522cea
7
- data.tar.gz: 71fa991cef307c2887ef90f797f01ca81d30c44b50db4634789b31eaef493ae2ffd76b20bfb249ec6088a42952d1bbc9794f3c4a661ec079eb247bc2c5409be0
6
+ metadata.gz: 280af413f3b244033571099deffac8cd74b7baee11cf442189790340fa9d7d8147146df876ecd9aacc8e3c1c0a6e08c0798a4b951021bde84b7e286d4a68054a
7
+ data.tar.gz: ed6bec0277cc55ba920b642e52328b566b142dbd6d4a2ae8b4be9361ea2188927824623aee119847887db12ed867a9c06f55b50675fd20f20acdaa9af8f1b357
data/j7w1.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'j7_w1/version'
4
+ require 'j7w1/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "j7w1"
data/lib/j7w1.rb CHANGED
@@ -1,8 +1,12 @@
1
1
  require 'yaml'
2
2
 
3
3
  module J7W1
4
- autoload :Configuration, 'j7_w1/configuration'
5
- autoload :Util, 'j7_w1/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
- require 'j7_w1/mock'
22
+ autoload :PushClient, 'j7w1/mock'
19
23
  return
20
24
  end
21
25
 
22
- require 'j7_w1/concrete'
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
- sns_client = self.create_sns_client
33
- aplication_devices.each do |device|
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 name: name,
18
- platform: (sandbox ? 'APNS_SANDBOX' : 'APNS'),
19
- attributes: {
20
- 'PlatformCredential' => private_key,
21
- 'PlatformPrincipal' => certs,
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
 
File without changes
@@ -0,0 +1,3 @@
1
+ module J7W1
2
+ VERSION = "0.0.7"
3
+ end
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.6
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: ''
@@ -1,2 +0,0 @@
1
- require 'j7_w1/push_client'
2
- require 'j7_w1/active_record_ext' if Object.const_defined? :ActiveRecord
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
@@ -1,3 +0,0 @@
1
- module J7W1
2
- VERSION = "0.0.6"
3
- end