contact_sync 0.3.0 → 0.4.0
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 +4 -4
- data/lib/contact_sync/syncable.rb +0 -1
- data/lib/contact_sync/util/global_phone.rb +0 -1
- data/lib/contact_sync/util/string_phone.rb +0 -1
- data/lib/contact_sync/version.rb +1 -1
- data/lib/generators/install_contact_sync/templates/phone.rb +0 -19
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +17 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +4 -0
- data/test/dummy/log/test.log +18 -0
- metadata +11 -15
- data/app/assets/javascripts/con_sync/api/users_sync.js +0 -2
- data/app/assets/javascripts/con_sync/application.js +0 -13
- data/app/assets/stylesheets/con_sync/api/users_sync.css +0 -4
- data/app/assets/stylesheets/con_sync/application.css +0 -15
- data/app/controllers/con_sync/api/users_sync_controller.rb +0 -27
- data/app/controllers/con_sync/application_controller.rb +0 -4
- data/app/helpers/con_sync/api/users_sync_helper.rb +0 -4
- data/app/helpers/con_sync/application_helper.rb +0 -4
- data/app/views/layouts/con_sync/application.html.erb +0 -14
- data/config/routes.rb +0 -0
- data/test/controllers/con_sync/api/users_sync_controller_test.rb +0 -9
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27e186fe2bab3eb269821b77334d51a7c5dc8d6b
|
4
|
+
data.tar.gz: d4c99c47e489eb07c9d568b145e64badb20ad743
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de4f960bea20a4f0d01ebf6ea7cf32f096037d6596725cc3c220d3e9aae6757383835ffe093dc7234494212c9c06c03e69cf9c1754d293a845b8bdf8cf10326a
|
7
|
+
data.tar.gz: 2da95cfc993f2c0e91f967d2b82a85df4d890f047534b907ace50f1f19b17eee02cb70217fc6f693172a9ead93e6462b34238aec26084b969ffddb028edb5d6b
|
data/lib/contact_sync/version.rb
CHANGED
@@ -16,23 +16,4 @@ class Phone < ActiveRecord::Base
|
|
16
16
|
save_with_format
|
17
17
|
save
|
18
18
|
end
|
19
|
-
|
20
|
-
private
|
21
|
-
def extract_country_code(string)
|
22
|
-
if string[0..1] == "00"
|
23
|
-
string[0..1] = "+"
|
24
|
-
end
|
25
|
-
if string[0] == "+"
|
26
|
-
breakdown = GlobalPhone.parse(string)
|
27
|
-
prefix = breakdown.country_code
|
28
|
-
num = breakdown.national_string
|
29
|
-
return [prefix,num]
|
30
|
-
elsif string[0] == "0"
|
31
|
-
num = string[1..-1]
|
32
|
-
prefix = "0"
|
33
|
-
return [prefix, num]
|
34
|
-
else
|
35
|
-
return ["", string]
|
36
|
-
end
|
37
|
-
end
|
38
19
|
end
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 0) do
|
15
|
+
|
16
|
+
|
17
|
+
end
|
Binary file
|
@@ -0,0 +1,4 @@
|
|
1
|
+
[1m[36m (4.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
2
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
+
[1m[36m (1.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
[1m[36m (3.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
2
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
+
[1m[36m (0.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
5
|
+
[1m[36m (0.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
6
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
7
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
8
|
+
[1m[36m (6.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
9
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
10
|
+
[1m[36m (1.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
11
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
12
|
+
[1m[36m (1.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
13
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
14
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
15
|
+
---------------------------
|
16
|
+
ContactSyncTest: test_truth
|
17
|
+
---------------------------
|
18
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contact_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saad Masood
|
@@ -77,16 +77,6 @@ files:
|
|
77
77
|
- MIT-LICENSE
|
78
78
|
- README.rdoc
|
79
79
|
- Rakefile
|
80
|
-
- app/assets/javascripts/con_sync/api/users_sync.js
|
81
|
-
- app/assets/javascripts/con_sync/application.js
|
82
|
-
- app/assets/stylesheets/con_sync/api/users_sync.css
|
83
|
-
- app/assets/stylesheets/con_sync/application.css
|
84
|
-
- app/controllers/con_sync/api/users_sync_controller.rb
|
85
|
-
- app/controllers/con_sync/application_controller.rb
|
86
|
-
- app/helpers/con_sync/api/users_sync_helper.rb
|
87
|
-
- app/helpers/con_sync/application_helper.rb
|
88
|
-
- app/views/layouts/con_sync/application.html.erb
|
89
|
-
- config/routes.rb
|
90
80
|
- db/global_phone.json
|
91
81
|
- lib/contact_sync.rb
|
92
82
|
- lib/contact_sync/acts_as_syncable.rb
|
@@ -107,14 +97,12 @@ files:
|
|
107
97
|
- lib/generators/install_contact_sync/templates/user.rb
|
108
98
|
- lib/tasks/con_sync_tasks.rake
|
109
99
|
- test/con_sync_test.rb
|
110
|
-
- test/controllers/con_sync/api/users_sync_controller_test.rb
|
111
100
|
- test/dummy/README.rdoc
|
112
101
|
- test/dummy/Rakefile
|
113
102
|
- test/dummy/app/assets/javascripts/application.js
|
114
103
|
- test/dummy/app/assets/stylesheets/application.css
|
115
104
|
- test/dummy/app/controllers/application_controller.rb
|
116
105
|
- test/dummy/app/helpers/application_helper.rb
|
117
|
-
- test/dummy/app/views/layouts/application.html.erb
|
118
106
|
- test/dummy/bin/bundle
|
119
107
|
- test/dummy/bin/rails
|
120
108
|
- test/dummy/bin/rake
|
@@ -138,6 +126,11 @@ files:
|
|
138
126
|
- test/dummy/config/locales/en.yml
|
139
127
|
- test/dummy/config/routes.rb
|
140
128
|
- test/dummy/config/secrets.yml
|
129
|
+
- test/dummy/db/development.sqlite3
|
130
|
+
- test/dummy/db/schema.rb
|
131
|
+
- test/dummy/db/test.sqlite3
|
132
|
+
- test/dummy/log/development.log
|
133
|
+
- test/dummy/log/test.log
|
141
134
|
- test/dummy/public/404.html
|
142
135
|
- test/dummy/public/422.html
|
143
136
|
- test/dummy/public/500.html
|
@@ -171,12 +164,10 @@ specification_version: 4
|
|
171
164
|
summary: Easy Contact Syncing API
|
172
165
|
test_files:
|
173
166
|
- test/con_sync_test.rb
|
174
|
-
- test/controllers/con_sync/api/users_sync_controller_test.rb
|
175
167
|
- test/dummy/app/assets/javascripts/application.js
|
176
168
|
- test/dummy/app/assets/stylesheets/application.css
|
177
169
|
- test/dummy/app/controllers/application_controller.rb
|
178
170
|
- test/dummy/app/helpers/application_helper.rb
|
179
|
-
- test/dummy/app/views/layouts/application.html.erb
|
180
171
|
- test/dummy/bin/bundle
|
181
172
|
- test/dummy/bin/rails
|
182
173
|
- test/dummy/bin/rake
|
@@ -200,6 +191,11 @@ test_files:
|
|
200
191
|
- test/dummy/config/routes.rb
|
201
192
|
- test/dummy/config/secrets.yml
|
202
193
|
- test/dummy/config.ru
|
194
|
+
- test/dummy/db/development.sqlite3
|
195
|
+
- test/dummy/db/schema.rb
|
196
|
+
- test/dummy/db/test.sqlite3
|
197
|
+
- test/dummy/log/development.log
|
198
|
+
- test/dummy/log/test.log
|
203
199
|
- test/dummy/public/404.html
|
204
200
|
- test/dummy/public/422.html
|
205
201
|
- test/dummy/public/500.html
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require_tree .
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require_dependency "contact_sync/application_controller"
|
2
|
-
|
3
|
-
module ContactSync
|
4
|
-
class Api::UsersSyncController < ApplicationController
|
5
|
-
def sync_contacts
|
6
|
-
if params[:contacts] && (params[:contacts][:new] or params[:contacts][:modified] or params[:contacts][:deleted])
|
7
|
-
sync_results = user.sync_contacts(params[:contacts])
|
8
|
-
# matched_contacts = user.match_contacts
|
9
|
-
# if current_user.update_attributes(contact_params)
|
10
|
-
# SyncContacts.perform_async
|
11
|
-
# # SyncContacts.perform_in(1.hour)
|
12
|
-
render json: {status: 200, message: "Contacts has been synced.", sync_info: sync_results}
|
13
|
-
else
|
14
|
-
render json: {status: 422, message: "Params not correct"}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def match_contacts
|
19
|
-
render json: {status: 200, matched_contacts: user.matched_contacts}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
def user
|
25
|
-
@user ||= current_user? ? current_user : User.find params[:id]
|
26
|
-
end
|
27
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>ContactSync</title>
|
5
|
-
<%= stylesheet_link_tag "contact_sync/application", media: "all" %>
|
6
|
-
<%= javascript_include_tag "contact_sync/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
data/config/routes.rb
DELETED
File without changes
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|