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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5e900a7be48f49be79425e22d77e9bb9c95ece7
4
- data.tar.gz: 874c33ae3454171a4905422b9f42a92033b33f49
3
+ metadata.gz: 27e186fe2bab3eb269821b77334d51a7c5dc8d6b
4
+ data.tar.gz: d4c99c47e489eb07c9d568b145e64badb20ad743
5
5
  SHA512:
6
- metadata.gz: 4396189df56c74da9bc5a373001586cb96a3deb805b41ec5990a1bac3fa1d0c9337e87bdf929e5516bef203066e7ad16f828f9b1fcc21147add49672aba9a332
7
- data.tar.gz: 89ecd495c072a6869a0194892cd4d20cdf478daefccb60fffd85279c94d9aea5e7cf9142b50870a2b22aedee87e6edca7a7ae80e212522b0927a17e5921fe025
6
+ metadata.gz: de4f960bea20a4f0d01ebf6ea7cf32f096037d6596725cc3c220d3e9aae6757383835ffe093dc7234494212c9c06c03e69cf9c1754d293a845b8bdf8cf10326a
7
+ data.tar.gz: 2da95cfc993f2c0e91f967d2b82a85df4d890f047534b907ace50f1f19b17eee02cb70217fc6f693172a9ead93e6462b34238aec26084b969ffddb028edb5d6b
@@ -60,7 +60,6 @@ module ContactSync
60
60
  if ! theContact.blank?
61
61
  if !theContact.update_attributes(contact_params(con))
62
62
  result[:modified][:failed] << theContact.record_id
63
- puts "Error Updating Contact."
64
63
  else
65
64
  # result[:modified][:success] << theContact.record_id
66
65
  end
@@ -1,3 +1,2 @@
1
1
  require 'global_phone'
2
- puts "\n\n\n\n\n\n\n\n\n\n\n#{ContactSync::Engine.root}\n\n\n\n\n\n\n\n"
3
2
  GlobalPhone.db_path = ContactSync::Engine.root.join('db/global_phone.json')
@@ -24,5 +24,4 @@ module ContactSync
24
24
  end
25
25
  end
26
26
 
27
- puts "Including StringPhoner Module to: '#{String.name}' class"
28
27
  String.send(:include, ContactSync::StringPhone)
@@ -1,3 +1,3 @@
1
1
  module ContactSync
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -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
+  (4.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.1ms) select sqlite_version(*)
3
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
@@ -0,0 +1,18 @@
1
+  (3.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.1ms) select sqlite_version(*)
3
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+  (0.1ms) SELECT version FROM "schema_migrations"
5
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
6
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
7
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
8
+  (6.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9
+  (0.1ms) select sqlite_version(*)
10
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
11
+  (0.1ms) SELECT version FROM "schema_migrations"
12
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
13
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
14
+  (0.1ms) begin transaction
15
+ ---------------------------
16
+ ContactSyncTest: test_truth
17
+ ---------------------------
18
+  (0.1ms) 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.3.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,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -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,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -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,4 +0,0 @@
1
- module ContactSync
2
- class ApplicationController < ActionController::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ContactSync
2
- module Api::UsersSyncHelper
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ContactSync
2
- module ApplicationHelper
3
- end
4
- 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,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module ContactSync
4
- class Api::UsersSyncControllerTest < ActionController::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -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>