phonofy 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab4c944e597b21fd5741b2fe4ae079894b23daef0b1ef5fb02591ea4f9656333
4
- data.tar.gz: ad2f6ae7a63313ab311570c18dd3205cd9026237704cb95daa7b2d48e1e004d5
3
+ metadata.gz: b628ab1214d8aaf8e00487444e04d5bcb54346296a29ed9b50ff5a838f6639ff
4
+ data.tar.gz: c2641d00024c02b51d724a960f7e8cd8b603ecc79f1168961b315adb070e3fd3
5
5
  SHA512:
6
- metadata.gz: 603aadd76e3845d374b472fce743f8bf553605715660a8d7a0926feeca4dd52d1def67bf0254ec433846a55d6722dc13373bd6278308db358d851b3bbb0afec1
7
- data.tar.gz: 19da8320b25ab52c32c8baa4e1603e984b85ae28d1f56250e12e160f7bf9c9951a1ddf02a9b3876e8dcb1b02ec673a12c16242bfbfb067105e8626f7a3fcb62b
6
+ metadata.gz: d2f7e112092e433f2db4513aa0ae8317632ffcf485e6f9bdb29b086de8e733e26d1a6859944e876fd08c20f5cc3e1d4298b4e4ffa2ad66fdb91cd3672b30fed2
7
+ data.tar.gz: 3ef7d410590278075723b4c263a9ef146f503ca7df101f507834060c08db1de671b9842089d3f67e446e1584682eaec07df25e5b545134842b50e0d8b1f6c775
data/README.md CHANGED
@@ -1,44 +1,81 @@
1
1
  # Phonofy
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/phonofy`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Phonofy is a Ruby gem that simplifies phone number formatting in Rails applications using the Phonelib library. With Phonofy, you can easily parse and format phone number data according to international standards, ensuring that your phone number data is consistent and valid across your application.
6
4
 
7
5
  ## Installation
8
6
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
7
+ Add this line to your application's Gemfile:
10
8
 
11
- Install the gem and add to the application's Gemfile by executing:
9
+ ```ruby
10
+ gem 'phonofy'
11
+ ```
12
12
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
13
+ And then execute:
14
14
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
15
+ ```shell
16
+ bundle
17
+ ```
16
18
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
19
+ Or install it yourself as:
18
20
 
19
- ## Usage
21
+ ```shell
22
+ gem install phonofy
23
+ ```
20
24
 
21
- TODO: Write usage instructions here
25
+ ## **Usage**
26
+ To use phonofy, simply call the **phonofy** method in your Rails model:
22
27
 
23
- To access configs:
28
+ ```ruby
29
+ class User < ApplicationRecord
30
+ phonofy
31
+ end
24
32
  ```
25
- User.phonofy_configs
33
+
34
+ This will add phone number validation and formatting to the **phone_number** attribute of the **Driver** model.
35
+
36
+ You can also specify a custom attribute name for the phone number:
37
+
38
+ ```ruby
39
+ class Contact < ApplicationRecord
40
+ phonofy :mobile_number
41
+ end
26
42
  ```
27
43
 
28
- ## Development
44
+ This will add phone number validation and formatting to the **mobile_number** attribute of the **Contact** model.
45
+
46
+ You can also pass additional options to phonofy to customize its behavior:
29
47
 
30
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+ ```ruby
49
+ class User < ApplicationRecord
50
+ phonofy :phone, phonelib: { countries: [:us, :ca], types: [:mobile] }
51
+ end
52
+ ```
53
+
54
+ This will add phone number validation and formatting to the **phone** attribute of the **User** model, and restrict it to US and Canada mobile phone numbers.
55
+
56
+
57
+ ## **Configuration**
58
+
59
+ You can configure phonofy by creating an initializer file in your Rails application and setting the default options:
60
+
61
+ ```ruby
62
+ # config/initializers/phonofy.rb
63
+ Phonofy.configure do |config|
64
+ config.default_phonelib_options = { countries: [:us, :ca], types: [:mobile] }
65
+ config.default_twilio_options = { lookup: { type: :carrier_type } }
66
+ end
67
+ ```
31
68
 
32
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
69
+ This will set the default options for phonofy to validate only US and Canada mobile phone numbers using the Phonelib library, and perform a Twilio lookup to get carrier information for the phone number.
33
70
 
34
- ## Contributing
71
+ ## **Contributing**
35
72
 
36
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/phonofy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/phonofy/blob/main/CODE_OF_CONDUCT.md).
73
+ Bug reports and pull requests are welcome on GitHub at https://github.com/shqear93/phonofy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct.
37
74
 
38
- ## License
75
+ ## **License**
39
76
 
40
77
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
78
 
42
- ## Code of Conduct
79
+ ## **Credits**
43
80
 
44
- Everyone interacting in the Phonofy project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/phonofy/blob/main/CODE_OF_CONDUCT.md).
81
+ phonofy was created by Khaled AbuShqear and is maintained by a community of contributors.
data/README.md.erb CHANGED
@@ -1,13 +1,13 @@
1
- # <%= gem_name.capitalize %>
1
+ # <%= spec.name.capitalize %>
2
2
 
3
- <%= gem_description %>
3
+ <%= spec.description %>
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem '<%= gem_name %>'
10
+ gem '<%= spec.name %>'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -19,11 +19,11 @@ bundle
19
19
  Or install it yourself as:
20
20
 
21
21
  ```shell
22
- gem install <%= gem_name %>
22
+ gem install <%= spec.name %>
23
23
  ```
24
24
 
25
25
  ## **Usage**
26
- To use <%= gem_name %>, simply call the **phonofy** method in your Rails model:
26
+ To use <%= spec.name %>, simply call the **phonofy** method in your Rails model:
27
27
 
28
28
  ```ruby
29
29
  class User < ApplicationRecord
@@ -43,7 +43,7 @@ end
43
43
 
44
44
  This will add phone number validation and formatting to the **mobile_number** attribute of the **Contact** model.
45
45
 
46
- You can also pass additional options to <%= gem_name %> to customize its behavior:
46
+ You can also pass additional options to <%= spec.name %> to customize its behavior:
47
47
 
48
48
  ```ruby
49
49
  class User < ApplicationRecord
@@ -56,21 +56,21 @@ This will add phone number validation and formatting to the **phone** attribute
56
56
 
57
57
  ## **Configuration**
58
58
 
59
- You can configure <%= gem_name %> by creating an initializer file in your Rails application and setting the default options:
59
+ You can configure <%= spec.name %> by creating an initializer file in your Rails application and setting the default options:
60
60
 
61
61
  ```ruby
62
- # config/initializers/<%= gem_name %>.rb
63
- <%= gem_module %>.configure do |config|
62
+ # config/initializers/<%= spec.name %>.rb
63
+ <%= spec.name.capitalize %>.configure do |config|
64
64
  config.default_phonelib_options = { countries: [:us, :ca], types: [:mobile] }
65
65
  config.default_twilio_options = { lookup: { type: :carrier_type } }
66
66
  end
67
67
  ```
68
68
 
69
- This will set the default options for <%= gem_name %> to validate only US and Canada mobile phone numbers using the Phonelib library, and perform a Twilio lookup to get carrier information for the phone number.
69
+ This will set the default options for <%= spec.name %> to validate only US and Canada mobile phone numbers using the Phonelib library, and perform a Twilio lookup to get carrier information for the phone number.
70
70
 
71
71
  ## **Contributing**
72
72
 
73
- Bug reports and pull requests are welcome on GitHub at <%= github_url %>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct.
73
+ Bug reports and pull requests are welcome on GitHub at <%= spec.metadata["source_code_uri"] %>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct.
74
74
 
75
75
  ## **License**
76
76
 
@@ -78,4 +78,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
78
78
 
79
79
  ## **Credits**
80
80
 
81
- <%= gem_name %> was created by <%= author_name %> and is maintained by a community of contributors.
81
+ <%= spec.name %> was created by <%= spec.authors.first %> and is maintained by a community of contributors.
data/Rakefile CHANGED
@@ -12,11 +12,12 @@ RuboCop::RakeTask.new
12
12
  task default: %i[spec rubocop]
13
13
 
14
14
  require "erb"
15
+ spec = Gem::Specification.load("phonofy.gemspec")
15
16
 
16
17
  desc "Generate README.md from template"
17
18
  task :readme do
18
19
  template = File.read("README.md.erb")
19
- readme = ERB.new(template).result(binding)
20
+ readme = ERB.new(template).result_with_hash({ spec: spec })
20
21
  File.write("README.md", readme)
21
22
  end
22
23
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phonofy
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonofy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khaled AbuShqear