github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

pluginaweek / has_phone_numbers

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 13
    • 1
  • Source
  • Commits
  • Network (1)
  • Downloads (7)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (7)
    • v0.2.0
    • v0.1.0
    • v0.0.5
    • v0.0.4
    • v0.0.3
    • v0.0.2
    • v0.0.1
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Demonstrates a reference implementation for handling phone numbers — Read more

  cancel

http://www.pluginaweek.org

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Add gemspec 
obrie (author)
Tue Jun 09 20:32:46 -0700 2009
commit  57bcf94d67fb2e7d1481f4641cf0161b806229c1
tree    b80762fd8e17ee49694cc715c9f73ce9d4856413
parent  4a02eadd91a8438f8a8b551064573e7ceb4d5e17
has_phone_numbers /
name age
history
message
file .gitignore Fri Jul 04 15:48:18 -0700 2008 Ignore test/app_root/script [obrie]
file CHANGELOG.rdoc Sun Apr 19 11:48:17 -0700 2009 Tag 0.2.0 release [obrie]
file LICENSE Sat Apr 18 19:24:15 -0700 2009 Update license [obrie]
file README.rdoc Sun Apr 19 13:25:21 -0700 2009 More doc fixes [obrie]
file Rakefile Tue Jun 09 20:32:46 -0700 2009 Add gemspec [obrie]
directory app/ Sun Apr 19 13:25:54 -0700 2009 Fix invalid examples in PhoneNumber#content [obrie]
directory db/ Sun May 04 16:00:19 -0700 2008 Updated documentation [obrie]
file has_phone_numbers.gemspec Tue Jun 09 20:32:46 -0700 2009 Add gemspec [obrie]
file init.rb Sun May 04 16:00:19 -0700 2008 Updated documentation [obrie]
directory lib/ Sat Apr 18 19:49:56 -0700 2009 Style tweaks [obrie]
directory test/ Sun Apr 19 11:40:30 -0700 2009 Add the ability to parse raw values [mlightner]
README.rdoc

has_phone_numbers

has_phone_numbers demonstrates a reference implementation for handling phone numbers.

Resources

API

  • api.pluginaweek.org/has_phone_numbers

Bugs

  • pluginaweek.lighthouseapp.com/projects/13275-has_phone_numbers

Development

  • github.com/pluginaweek/has_phone_numbers

Source

  • git://github.com/pluginaweek/has_phone_numbers.git

Description

A phone number is a simple model whose data and functionality should be standardized across multiple applications. Phone numbers are minimalistic in terms of the type of data it represents. Both U.S. and international formats are supported.

Usage

Note that this is a reference implementation and, most likely, will be modified for your own usage.

Example

Building with individual segments:

  PhoneNumber.create(:phoneable => user, :country_code => '1', :number => '1234567890', :extension => '123')
  # #<PhoneNumber id: 1, phoneable_id: 1, phoneable_type: "User", country_code: "1", number: "1234567890", extension: "123", created_at: "2009-01-01 00:00:00", updated_at: "2009-01-01 00:00:00">

Parsing raw values:

  PhoneNumber.create(:phoneable => user, :content => '1 1234567890 ext. 123')
  # #<PhoneNumber id: 1, phoneable_id: 1, phoneable_type: "User", country_code: "1", number: "1234567890", extension: "123", created_at: "2009-01-01 00:00:00", updated_at: "2009-01-01 00:00:00">

  PhoneNumber.create(:phoneable => user, :content => '231 331 996 x4621')
  # #<PhoneNumber id: 1, phoneable_id: 1, phoneable_type: "User", country_code: "231", number: "331996", extension: "4621", created_at: "2009-01-01 00:00:00", updated_at: "2009-01-01 00:00:00">

  PhoneNumber.create(:phoneable => user, :content => '+ 386 1 5853 449')
  # #<PhoneNumber id: 1, phoneable_id: 1, phoneable_type: "User", country_code: "386", number: "15853449", extension: nil, created_at: "2009-01-01 00:00:00", updated_at: "2009-01-01 00:00:00">

  PhoneNumber.create(:phoneable => user, :content => '+39-02-4823001')
  # #<PhoneNumber id: 1, phoneable_id: 1, phoneable_type: "User", country_code: "39", number: "024823001", extension: nil, created_at: "2009-01-01 00:00:00", updated_at: "2009-01-01 00:00:00">

Testing

Before you can run any tests, the following gem must be installed:

  • plugin_test_helper

To run against a specific version of Rails:

  rake test RAILS_FRAMEWORK_ROOT=/path/to/rails

Dependencies

  • Rails 2.3 or later

References

  • Casey West - Parse-PhoneNumber
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server