onesignal 0.2.0 → 0.3.0

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: 1d1a29d0d02ff0e3b749a77da48c9af71fef56a9
4
- data.tar.gz: 4ac7e0a67d93f3239ef27fc72da955718c7a1741
3
+ metadata.gz: 0d3ca7d6cbaf4ccca38afdf280d06402bc5249ba
4
+ data.tar.gz: fe9bd8ead86744e0c1e2a7abc955645d58681a55
5
5
  SHA512:
6
- metadata.gz: 2661a29b31b7710a63b0441a39973f20c3b66c16c712974b1bd15aad0f9b349d849909540217c07f5de43f06be1c6551b8029da13d56987d1ebe3e342209f6de
7
- data.tar.gz: 8738408d1d19eda8d65bc42995d8445fd46941e074fb4478f982feaec37a86a9832998a121124c71466e90023cd463b31f68ebd83f0553ebf23a640b7e2e4794
6
+ metadata.gz: de637cf8ca145013e3d15e839a65ce44c96c829e3ae85fea3398c5748f897b414ea12966142f1b281eef8ba107723ddfc8005bc31651a69760fd151c725ee277
7
+ data.tar.gz: 0cdbbc1d1a4814a2a678f45f57eb6649a6cba7743af3d1306e7e8bcfc98860148fcc08e9d0bc3a148c4a66b52799c98a8513248e3bcb07679e38f2e09bd7a40e
@@ -2,6 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [0.3.0] - 2016-05-10
6
+ ### Added
7
+ * Models dynamically create attributes on initialization
8
+
5
9
  ## [0.2.0] - 2016-04-29
6
10
  ### Added
7
11
  * Ruby 2.0 compatibility
@@ -14,4 +18,5 @@ This project adheres to [Semantic Versioning](http://semver.org/).
14
18
  ### Added
15
19
  * Methods for all OneSignal resources
16
20
 
21
+ [0.3.0]: https://github.com/coding-chimp/onesignal/compare/v0.2.0...v0.3.0
17
22
  [0.2.0]: https://github.com/coding-chimp/onesignal/compare/v0.1.0...v0.2.0
@@ -4,14 +4,6 @@ module OneSignal
4
4
  class App < BaseModel
5
5
  DATE_REGEX = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/
6
6
 
7
- attr_accessor :apns_certificates, :apns_env, :basic_auth_key, :chrome_key,
8
- :chrome_web_default_notification_icon, :chrome_web_gcm_sender_id,
9
- :chrome_web_origin, :chrome_web_sub_domain, :created_at, :gcm_key, :id,
10
- :messageable_players, :name, :players, :safari_apns_certificate,
11
- :safari_icon_128_128, :safari_icon_16_16, :safari_icon_256_256,
12
- :safari_icon_32_32, :safari_icon_64_64, :safari_push_id,
13
- :safari_site_origin, :site_name, :updated_at
14
-
15
7
  def created_at=(time)
16
8
  parse_time('created_at', time)
17
9
  end
@@ -5,7 +5,10 @@ module OneSignal
5
5
  end
6
6
 
7
7
  def initialize(attributes = {})
8
- attributes.each { |key, value| send("#{key}=", value) }
8
+ attributes.each do |key, value|
9
+ create_attr(key)
10
+ send("#{key}=", value)
11
+ end
9
12
  end
10
13
 
11
14
  def inspect
@@ -15,5 +18,23 @@ module OneSignal
15
18
 
16
19
  "<#{self.class.name} #{values}>"
17
20
  end
21
+
22
+ private
23
+
24
+ def create_attr(name)
25
+ create_method("#{name}=".to_sym) do |value|
26
+ instance_variable_set("@#{name}", value)
27
+ end
28
+
29
+ create_method(name.to_sym) do
30
+ instance_variable_get("@#{name}")
31
+ end
32
+ end
33
+
34
+ def create_method(name, &block)
35
+ unless respond_to?(name)
36
+ self.class.send(:define_method, name, &block)
37
+ end
38
+ end
18
39
  end
19
40
  end
@@ -1,10 +1,5 @@
1
1
  module OneSignal
2
2
  class Notification < BaseModel
3
- attr_accessor :canceled, :contents, :converted, :data, :errored, :failed,
4
- :headings, :id, :include_player_ids, :included_segments, :isAdm,
5
- :isAndroid, :isChrome, :isChromeWeb, :isFirefox, :isIos, :isSafari,
6
- :isWP, :isWP_WNS, :queued_at, :remaining, :send_after, :successful, :url
7
-
8
3
  def queued_at=(time)
9
4
  @queued_at = Time.at(time)
10
5
  end
@@ -1,10 +1,5 @@
1
1
  module OneSignal
2
2
  class Player < BaseModel
3
- attr_accessor :ad_id, :amount_spent, :badge_count, :created_at,
4
- :device_model, :device_os, :device_type, :game_version, :id, :identifier,
5
- :invalid_identifier, :language, :last_active, :playtime, :session_count,
6
- :sdk, :tags, :timezone
7
-
8
3
  def created_at=(time)
9
4
  @created_at = Time.at(time)
10
5
  end
@@ -1,3 +1,3 @@
1
1
  module OneSignal
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onesignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bastian Bartmann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler