notifiable-rails 0.22.0 → 0.22.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: d5014e70f5effbb94e7a1ebb03609f1da440afa2
4
- data.tar.gz: fe49b8984bdcb552611eae8fbc823e365ace422f
3
+ metadata.gz: b109b7e4229eae4cc3b4033b5443695cf79efa1c
4
+ data.tar.gz: 94a994b5dccaac5d746602c77e15a4c13b1d3ec1
5
5
  SHA512:
6
- metadata.gz: 75b3a1cb6b9eca406b5492ea4725b864ed447648a0a07672e2a5f4be6c87806af2f0bb1d1fce0c67784d06f6d32194a6f483701d245de75e2a2924e67658b915
7
- data.tar.gz: 3bea679c56e33a30690fd3431c30ba10789da8a7f5d6408e53f381d01428951c2787bb0b75ad1e84a7cf96f1b3757750279d53a7b13b517abcbff766ca9aa46a
6
+ metadata.gz: 67da3afd51f2d586796dea736ffec204ae6787a7293e66ab491afbb6265bc66cb00201534039d6c9285307b32f8bbdef9a12491341907fc174f949c80974f25d
7
+ data.tar.gz: ff2c59f101908c96f1cfca9d16b396e9e068ed64c57d1922307b6c871d13e2f1f29e96cbf9fa8eb2906d7bf04792b07c75495be90ebc74c02594660078bd2596
@@ -0,0 +1,7 @@
1
+ class AddNameToNotifiableDeviceTokens < ActiveRecord::Migration
2
+
3
+ def change
4
+ add_column :notifiable_device_tokens, :name, :string
5
+ end
6
+
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Notifiable
2
- VERSION = "0.22.0"
2
+ VERSION = "0.22.1"
3
3
  end
data/lib/notifiable.rb CHANGED
@@ -14,7 +14,7 @@ module Notifiable
14
14
  mattr_accessor :api_controller_class
15
15
 
16
16
  mattr_accessor :api_device_token_params
17
- @@api_device_token_params = [:token, :provider, :app_id, :locale]
17
+ @@api_device_token_params = [:token, :provider, :app_id, :locale, :name]
18
18
 
19
19
  mattr_accessor :locales
20
20
  @@locales = [:en]
@@ -12,12 +12,13 @@ describe Notifiable::DeviceTokensController do
12
12
  let(:user1) { create(:user) }
13
13
  let(:app) { create(:app) }
14
14
 
15
- before(:each) { post :create, :token => "ABC123", :user_email => user1.email, :provider => :apns, :app_id => app.id }
15
+ before(:each) { post :create, :token => "ABC123", :name => "Matt's iPhone", :user_email => user1.email, :provider => :apns, :app_id => app.id }
16
16
 
17
17
  it { expect(response.status).to eq 200 }
18
18
  it { expect(json['id']).to_not be_nil }
19
19
  it { expect(Notifiable::DeviceToken.count).to eq 1 }
20
20
  it { expect(Notifiable::DeviceToken.first.token).to eq "ABC123" }
21
+ it { expect(Notifiable::DeviceToken.first.name).to eq "Matt's iPhone" }
21
22
  it { expect(Notifiable::DeviceToken.first.provider).to eq "apns" }
22
23
  it { expect(Notifiable::DeviceToken.first.app).to eq app }
23
24
  it { expect(User.first.device_tokens.count).to eq 1 }
@@ -8,6 +8,12 @@ describe Notifiable::DeviceToken do
8
8
  it { expect(token.locale).to eq 'en' }
9
9
  end
10
10
 
11
+ describe "#name" do
12
+ subject(:token) { create(:mock_token, :name => "Matt's iPhone") }
13
+
14
+ it { expect(token.name).to eq "Matt's iPhone" }
15
+ end
16
+
11
17
  describe "#notification_statuses" do
12
18
  subject(:token) { create(:mock_token, :notification_statuses => create_list(:notification_status, 2)) }
13
19
 
Binary file
@@ -24,6 +24,7 @@ ActiveRecord::Schema.define(version: 20131210115660) do
24
24
  t.string "token"
25
25
  t.string "provider"
26
26
  t.string "locale"
27
+ t.string "name"
27
28
  t.boolean "is_valid", default: true
28
29
  t.integer "user_id"
29
30
  t.integer "app_id"
Binary file
@@ -1646810,3 +1646810,63 @@ Migrating to CreateUsers (20131210115652)
1646810
1646810
  WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
1646811
1646811
 
1646812
1646812
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1646813
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
1646814
+ Migrating to AddNameToNotifiableDeviceTokens (20131210115653)
1646815
+  (0.1ms) begin transaction
1646816
+  (0.7ms) ALTER TABLE "notifiable_device_tokens" ADD "name" varchar(255)
1646817
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131210115653"]]
1646818
+  (0.9ms) commit transaction
1646819
+ Migrating to CreateUsers (20131210115660)
1646820
+  (0.0ms) begin transaction
1646821
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL) 
1646822
+ SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
1646823
+  (0.1ms) rollback transaction
1646824
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1646825
+ Migrating to CreateUsers (20131210115660)
1646826
+  (0.0ms) begin transaction
1646827
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL) 
1646828
+ SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
1646829
+  (0.0ms) rollback transaction
1646830
+  (1.1ms) CREATE TABLE "notifiable_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "configuration" text, "created_at" datetime, "updated_at" datetime) 
1646831
+  (0.9ms) CREATE TABLE "notifiable_device_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "token" varchar(255), "provider" varchar(255), "locale" varchar(255), "name" varchar(255), "is_valid" boolean DEFAULT 't', "user_id" integer, "app_id" integer, "created_at" datetime, "updated_at" datetime)
1646832
+  (0.1ms) select sqlite_version(*)
1646833
+  (0.6ms) CREATE UNIQUE INDEX "index_notifiable_device_tokens_on_token" ON "notifiable_device_tokens" ("token")
1646834
+  (0.1ms)  SELECT sql
1646835
+ FROM sqlite_master
1646836
+ WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
1646837
+ UNION ALL
1646838
+ SELECT sql
1646839
+ FROM sqlite_temp_master
1646840
+ WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
1646841
+ 
1646842
+  (0.6ms) CREATE INDEX "index_notifiable_device_tokens_on_user_id" ON "notifiable_device_tokens" ("user_id")
1646843
+  (0.6ms) CREATE TABLE "notifiable_localized_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message" text, "params" text, "locale" varchar(255), "notification_id" integer, "created_at" datetime, "updated_at" datetime) 
1646844
+  (0.6ms) CREATE TABLE "notifiable_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "app_id" integer, "sent_count" integer DEFAULT 0, "gateway_accepted_count" integer DEFAULT 0, "opened_count" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime)
1646845
+  (0.5ms) CREATE TABLE "notifiable_statuses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "localized_notification_id" integer, "device_token_id" integer, "status" integer, "created_at" datetime) 
1646846
+  (0.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
1646847
+  (0.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
1646848
+  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1646849
+  (0.1ms) SELECT version FROM "schema_migrations"
1646850
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131210115660')
1646851
+  (0.9ms) CREATE TABLE "notifiable_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "configuration" text, "created_at" datetime, "updated_at" datetime) 
1646852
+  (0.7ms) CREATE TABLE "notifiable_device_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "token" varchar(255), "provider" varchar(255), "locale" varchar(255), "name" varchar(255), "is_valid" boolean DEFAULT 't', "user_id" integer, "app_id" integer, "created_at" datetime, "updated_at" datetime)
1646853
+  (0.1ms) select sqlite_version(*)
1646854
+  (0.6ms) CREATE UNIQUE INDEX "index_notifiable_device_tokens_on_token" ON "notifiable_device_tokens" ("token")
1646855
+  (0.1ms)  SELECT sql
1646856
+ FROM sqlite_master
1646857
+ WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
1646858
+ UNION ALL
1646859
+ SELECT sql
1646860
+ FROM sqlite_temp_master
1646861
+ WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
1646862
+ 
1646863
+  (0.6ms) CREATE INDEX "index_notifiable_device_tokens_on_user_id" ON "notifiable_device_tokens" ("user_id")
1646864
+  (0.7ms) CREATE TABLE "notifiable_localized_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message" text, "params" text, "locale" varchar(255), "notification_id" integer, "created_at" datetime, "updated_at" datetime) 
1646865
+  (0.6ms) CREATE TABLE "notifiable_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "app_id" integer, "sent_count" integer DEFAULT 0, "gateway_accepted_count" integer DEFAULT 0, "opened_count" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime)
1646866
+  (0.7ms) CREATE TABLE "notifiable_statuses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "localized_notification_id" integer, "device_token_id" integer, "status" integer, "created_at" datetime) 
1646867
+  (0.6ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
1646868
+  (0.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
1646869
+  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1646870
+  (0.1ms) SELECT version FROM "schema_migrations"
1646871
+  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20131210115660')
1646872
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"