central_office 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +27 -0
- data/app/models/subscription.rb +3 -0
- data/app/models/twilio_number.rb +9 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20141006222340_create_twilio_numbers.rb +12 -0
- data/db/migrate/20141006222344_create_subscriptions.rb +13 -0
- data/lib/central_office/engine.rb +4 -0
- data/lib/central_office/version.rb +3 -0
- data/lib/central_office.rb +4 -0
- data/lib/tasks/central_office_tasks.rake +4 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5150497be9f95370000d2b259515b247644bd631
|
4
|
+
data.tar.gz: 7a68fbedcb99f8d816c67e3b1e9fb2683e6bb5f9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 065c2db86a89def60cc7b356c8dda6f9c3e40b56d4fec89806628324268d9bfa863ea5b439954696b162601c051bc077a113c84a2ad901f8ff9b2a5980ad9411
|
7
|
+
data.tar.gz: abdec26f699e8fd1e8f1f8c055d22ccff83c392c273752c422f613ac3b589f7dbff414fa9b64dadf4f1ee060dbd3713c0cb3c81336efa233b901c93fffa6a431
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'CentralOffice'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class TwilioNumber < ActiveRecord::Base
|
2
|
+
has_many :subscriptions, inverse_of: :twilio_number
|
3
|
+
|
4
|
+
scope(:available, lambda do |subscription_phone_number|
|
5
|
+
subscriptions = Subscription.where(phone_number: subscription_phone_number)
|
6
|
+
unavailable_ids = subscriptions.select(:twilio_number_id).uniq
|
7
|
+
where.not(id: unavailable_ids)
|
8
|
+
end)
|
9
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateTwilioNumbers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :twilio_numbers do |t|
|
4
|
+
t.string :phone_number, null: false
|
5
|
+
t.string :sid, null: false
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :twilio_numbers, :sid, unique: true
|
10
|
+
add_index :twilio_numbers, :phone_number, unique: true
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateSubscriptions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :subscriptions do |t|
|
4
|
+
t.belongs_to :twilio_number, null: false
|
5
|
+
t.string :phone_number, null: false
|
6
|
+
t.string :topic_name, null: false
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :subscriptions, [:twilio_number_id, :phone_number], unique: true
|
11
|
+
add_index :subscriptions, [:phone_number, :topic_name], unique: true
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: central_office
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Or Be Square, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.19
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.19
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pg
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- MIT-LICENSE
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
50
|
+
- app/models/subscription.rb
|
51
|
+
- app/models/twilio_number.rb
|
52
|
+
- config/routes.rb
|
53
|
+
- db/migrate/20141006222340_create_twilio_numbers.rb
|
54
|
+
- db/migrate/20141006222344_create_subscriptions.rb
|
55
|
+
- lib/central_office.rb
|
56
|
+
- lib/central_office/engine.rb
|
57
|
+
- lib/central_office/version.rb
|
58
|
+
- lib/tasks/central_office_tasks.rake
|
59
|
+
homepage:
|
60
|
+
licenses: []
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.2.2
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Rails engine for managing Twilio phone numbers and SMS subscriptions
|
82
|
+
test_files: []
|