pushr-gcm 1.0.0.pre.4 → 1.0.0.rc.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55ef9497405d8415d4a814f670165a5542e8e89d
4
- data.tar.gz: efe1a18d46c7d2205aa2ed5effb8a9af004539cd
3
+ metadata.gz: eacd1d24b8a94657b4329e960f0e6a5864fb7b5a
4
+ data.tar.gz: be1116d4b35743ca8db413c4d6d557a421a7034b
5
5
  SHA512:
6
- metadata.gz: 155cb8dba85a0b4ef221274950c36a2eafebd5353ec7dd32e01deb228c3b3f5801bcba6f6e23e0356bb951596b788e2967cfa8b081963dee9660c662142f61c1
7
- data.tar.gz: 8ae2dfcb65d580f13f75559dda231c94dc59ef9129fd383f6af07c363972f2bef0f1137a4bdefd4952e947ebf81ceec23f083061fcf3c8b142a7aece99142742
6
+ metadata.gz: b46ec7bcade405d6df91d789a648a868db8fb0ed95b102e068a4b11ef958dbdac3649ffafc09299cd397adc1601e87d88acf1db4f93e89437b446124c255fce6
7
+ data.tar.gz: f900c4a5fda73b443594d5ddaa544a0530c284610ad2a05ec2f04d690802560d4595d42e7d10609fbf7e2789a0dda29a8cb9ece9b77e97792374dd264df9ccf1
@@ -1,3 +1,3 @@
1
1
  module PushrGcm
2
- VERSION = '1.0.0.pre.4'
2
+ VERSION = '1.0.0.rc.1'
3
3
  end
@@ -1,14 +1,14 @@
1
1
  module Pushr
2
2
  class ConfigurationGcm < Pushr::Configuration
3
- attr_accessor :id, :type, :app, :enabled, :connections, :api
3
+ attr_accessor :api
4
4
  validates :api, presence: true
5
5
 
6
6
  def name
7
7
  :gcm
8
8
  end
9
9
 
10
- def to_json
11
- MultiJson.dump(type: self.class.to_s, app: app, enabled: enabled, connections: connections, api: api)
10
+ def to_hash
11
+ { type: self.class.to_s, app: app, enabled: enabled, connections: connections, api: api }
12
12
  end
13
13
  end
14
14
  end
@@ -13,7 +13,7 @@ module Pushr
13
13
  connection = GcmSupport::ConnectionGcm.new(configuration, i + 1)
14
14
  connection.connect
15
15
 
16
- handler = MessageHandler.new("pushr:#{configuration.app}:#{configuration.name}", connection, configuration.app, i + 1)
16
+ handler = MessageHandler.new("pushr:#{configuration.key}", connection, configuration.app, i + 1)
17
17
  handler.start
18
18
  @handlers << handler
19
19
  end
@@ -1,12 +1,10 @@
1
1
  module Pushr
2
2
  class FeedbackGcm < Pushr::Feedback
3
- attr_accessor :type, :app, :device, :follow_up, :failed_at, :update_to
4
-
3
+ attr_accessor :device, :follow_up, :failed_at, :update_to
5
4
  validates :follow_up, inclusion: { in: %w(delete update), message: '%{value} is not a valid follow-up' }
6
5
 
7
- def to_json
8
- hsh = { type: 'Pushr::FeedbackGcm', app: app, device: device, follow_up: follow_up, failed_at: failed_at, update_to: update_to }
9
- MultiJson.dump(hsh)
6
+ def to_hash
7
+ { type: 'Pushr::FeedbackGcm', app: app, device: device, follow_up: follow_up, failed_at: failed_at, update_to: update_to }
10
8
  end
11
9
  end
12
10
  end
@@ -2,6 +2,8 @@ module Pushr
2
2
  class MessageGcm < Pushr::Message
3
3
  POSTFIX = 'gcm'
4
4
 
5
+ attr_accessor :registration_ids, :notification_key, :collapse_key, :delay_while_idle, :time_to_live, :data,
6
+ :restricted_package_name, :dry_run
5
7
  validates :registration_ids, presence: true
6
8
  validate :registration_ids_array
7
9
  validate :data_size
@@ -9,9 +11,6 @@ module Pushr
9
11
  validates :time_to_live, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 2419200 },
10
12
  allow_blank: true
11
13
 
12
- attr_accessor :type, :app, :registration_ids, :notification_key, :collapse_key, :delay_while_idle, :time_to_live, :data,
13
- :restricted_package_name, :dry_run
14
-
15
14
  def to_message
16
15
  hsh = {}
17
16
  hsh['registration_ids'] = registration_ids
@@ -21,10 +20,11 @@ module Pushr
21
20
  MultiJson.dump(hsh)
22
21
  end
23
22
 
24
- def to_json
23
+ def to_hash
25
24
  hsh = { type: self.class.to_s, app: app, registration_ids: registration_ids, notification_key: notification_key,
26
25
  collapse_key: collapse_key, delay_while_idle: delay_while_idle, time_to_live: time_to_live, data: data }
27
- MultiJson.dump(hsh)
26
+ hsh[Pushr::Core.external_id_tag] = external_id if external_id
27
+ hsh
28
28
  end
29
29
 
30
30
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushr-gcm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.4
4
+ version: 1.0.0.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Pesman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json