mcm_phone_number_generator 0.1.1 → 0.1.2
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/README.md +105 -123
- data/lib/mcm_phone_number_generator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09059b88c55fa03fb1d0a0aea1fb452445e8ebd37252a8658248f5a398414323'
|
4
|
+
data.tar.gz: 812d4027090a326a9eef23c343a9a02c778a8ac60335f1f6cd8b352cefe2ff4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05fcafb3061eaee0017073d1df4bf467cc956390a4b612687b68ccc827610b08a4db09986a447e7fcadd39d3e6e10e916173e49cbd716c411922db41a0eb7336
|
7
|
+
data.tar.gz: 416974ab30b91ed2e494a889ec849e4d3cda2210d740cc319ea3dbf250fc472786cde7e5aa02ece99857633cf4ab913580ac026053d72087c64ed4da2cce6780
|
data/README.md
CHANGED
@@ -18,106 +18,102 @@
|
|
18
18
|
Add the gem to your Gemfile:
|
19
19
|
```ruby
|
20
20
|
gem 'mcm_phone_number_generator'
|
21
|
-
```
|
22
|
-
|
23
21
|
Then run:
|
24
|
-
```bash
|
25
|
-
bundle install
|
26
|
-
```
|
27
22
|
|
23
|
+
bash
|
24
|
+
Copy
|
25
|
+
Edit
|
26
|
+
bundle install
|
28
27
|
Or install it manually:
|
29
|
-
```bash
|
30
|
-
gem install mcm_phone_number_generator
|
31
|
-
```
|
32
|
-
|
33
|
-
---
|
34
|
-
|
35
|
-
## Usage
|
36
28
|
|
37
|
-
|
29
|
+
bash
|
30
|
+
Copy
|
31
|
+
Edit
|
32
|
+
gem install mcm_phone_number_generator
|
33
|
+
Usage
|
34
|
+
Step 1: Require the Gem
|
38
35
|
Load the gem into your Ruby script:
|
39
|
-
```ruby
|
40
|
-
require 'mcm_phone_number_generator'
|
41
|
-
```
|
42
36
|
|
43
|
-
|
37
|
+
ruby
|
38
|
+
Copy
|
39
|
+
Edit
|
40
|
+
require 'mcm_phone_number_generator'
|
41
|
+
Step 2: Initialize the Client
|
44
42
|
Create an instance of the client. Specify the API URL for My Country Mobile:
|
45
|
-
|
43
|
+
|
44
|
+
ruby
|
45
|
+
Copy
|
46
|
+
Edit
|
46
47
|
client = MCMPhoneNumberGenerator::Client.new("https://www.mycountrymobile.com/api/v1")
|
47
|
-
|
48
|
+
Step 3: Generate a Phone Number
|
49
|
+
Call the generate_phone_number method with the required parameters:
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
ruby
|
52
|
+
Copy
|
53
|
+
Edit
|
52
54
|
params = { country: "US", type: "mobile" }
|
53
55
|
result = client.generate_phone_number(params)
|
54
56
|
puts "Generated Phone Number: #{result['number']}"
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
Example Output
|
58
|
+
json
|
59
|
+
Copy
|
60
|
+
Edit
|
59
61
|
{
|
60
62
|
"number": "+1-555-123-4567",
|
61
63
|
"country": "US",
|
62
64
|
"type": "mobile"
|
63
65
|
}
|
64
|
-
|
65
|
-
|
66
|
-
---
|
67
|
-
|
68
|
-
## API Parameters
|
69
|
-
|
70
|
-
The following parameters can be passed to the `generate_phone_number` method:
|
66
|
+
API Parameters
|
67
|
+
The following parameters can be passed to the generate_phone_number method:
|
71
68
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
---
|
78
|
-
|
79
|
-
## Error Handling
|
69
|
+
Parameter Type Required Description
|
70
|
+
country String Yes The country code (e.g., "US").
|
71
|
+
type String Yes The type of number (e.g., "mobile").
|
72
|
+
Phone Number Generator Tool
|
73
|
+
This gem is powered by the My Country Mobile Phone Number Generator Tool. For additional customization and manual testing, you can access the tool directly.
|
80
74
|
|
75
|
+
Error Handling
|
81
76
|
The gem includes robust error handling. Here's an example of how to handle errors gracefully:
|
82
|
-
|
77
|
+
|
78
|
+
ruby
|
79
|
+
Copy
|
80
|
+
Edit
|
83
81
|
begin
|
84
82
|
result = client.generate_phone_number(params)
|
85
83
|
puts "Generated Phone Number: #{result['number']}"
|
86
84
|
rescue MCMPhoneNumberGenerator::APIError => e
|
87
85
|
puts "An error occurred: #{e.message}"
|
88
86
|
end
|
89
|
-
```
|
90
|
-
|
91
87
|
Common error scenarios:
|
92
|
-
- **Network Errors:** Raised if there are issues connecting to the API.
|
93
|
-
- **Invalid Parameters:** Raised if required parameters are missing or invalid.
|
94
|
-
- **API Errors:** Raised if the API returns a non-successful response (e.g., `400 Bad Request`).
|
95
|
-
|
96
|
-
---
|
97
|
-
|
98
|
-
## Development
|
99
88
|
|
89
|
+
Network Errors: Raised if there are issues connecting to the API.
|
90
|
+
Invalid Parameters: Raised if required parameters are missing or invalid.
|
91
|
+
API Errors: Raised if the API returns a non-successful response (e.g., 400 Bad Request).
|
92
|
+
Development
|
100
93
|
To contribute or modify this gem:
|
101
|
-
1. Clone the repository:
|
102
|
-
```bash
|
103
|
-
git clone https://github.com/your-username/mcm_phone_number_generator.git
|
104
|
-
cd mcm_phone_number_generator
|
105
|
-
```
|
106
|
-
2. Install dependencies:
|
107
|
-
```bash
|
108
|
-
bundle install
|
109
|
-
```
|
110
|
-
3. Run tests:
|
111
|
-
```bash
|
112
|
-
bundle exec rspec
|
113
|
-
```
|
114
|
-
|
115
|
-
---
|
116
|
-
|
117
|
-
## Example Application
|
118
94
|
|
95
|
+
Clone the repository:
|
96
|
+
bash
|
97
|
+
Copy
|
98
|
+
Edit
|
99
|
+
git clone https://github.com/khanaariyan/mcm_phone_number_generator.git
|
100
|
+
cd mcm_phone_number_generator
|
101
|
+
Install dependencies:
|
102
|
+
bash
|
103
|
+
Copy
|
104
|
+
Edit
|
105
|
+
bundle install
|
106
|
+
Run tests:
|
107
|
+
bash
|
108
|
+
Copy
|
109
|
+
Edit
|
110
|
+
bundle exec rspec
|
111
|
+
Example Application
|
119
112
|
Here’s a quick example of how you can use this gem in a real-world application:
|
120
|
-
|
113
|
+
|
114
|
+
ruby
|
115
|
+
Copy
|
116
|
+
Edit
|
121
117
|
require 'mcm_phone_number_generator'
|
122
118
|
|
123
119
|
client = MCMPhoneNumberGenerator::Client.new("https://www.mycountrymobile.com/api/v1")
|
@@ -129,65 +125,51 @@ begin
|
|
129
125
|
rescue MCMPhoneNumberGenerator::APIError => e
|
130
126
|
puts "Error: #{e.message}"
|
131
127
|
end
|
132
|
-
|
133
|
-
|
134
|
-
---
|
135
|
-
|
136
|
-
## Contributing
|
137
|
-
|
128
|
+
Contributing
|
138
129
|
Contributions are welcome! Please open an issue or submit a pull request if you'd like to contribute to this gem.
|
139
130
|
|
140
131
|
To contribute:
|
141
|
-
1. Fork the repository.
|
142
|
-
2. Create a new branch for your feature or bugfix:
|
143
|
-
```bash
|
144
|
-
git checkout -b my-new-feature
|
145
|
-
```
|
146
|
-
3. Commit your changes:
|
147
|
-
```bash
|
148
|
-
git commit -am 'Add new feature'
|
149
|
-
```
|
150
|
-
4. Push to the branch:
|
151
|
-
```bash
|
152
|
-
git push origin my-new-feature
|
153
|
-
```
|
154
|
-
5. Open a pull request on GitHub.
|
155
|
-
|
156
|
-
---
|
157
|
-
|
158
|
-
## License
|
159
|
-
|
160
|
-
This gem is open-source and available under the [MIT License](https://opensource.org/licenses/MIT).
|
161
|
-
|
162
|
-
---
|
163
|
-
|
164
|
-
## Additional Resources
|
165
|
-
|
166
|
-
- [My Country Mobile Phone Number Generator Tool](https://www.mycountrymobile.com/tools/phone-number-generator/)
|
167
|
-
- [Ruby Gems Documentation](https://guides.rubygems.org/)
|
168
|
-
- [HTTParty Documentation](https://github.com/jnunemaker/httparty)
|
169
|
-
|
170
|
-
---
|
171
|
-
|
172
|
-
## Contact
|
173
132
|
|
133
|
+
Fork the repository.
|
134
|
+
Create a new branch for your feature or bugfix:
|
135
|
+
bash
|
136
|
+
Copy
|
137
|
+
Edit
|
138
|
+
git checkout -b my-new-feature
|
139
|
+
Commit your changes:
|
140
|
+
bash
|
141
|
+
Copy
|
142
|
+
Edit
|
143
|
+
git commit -am 'Add new feature'
|
144
|
+
Push to the branch:
|
145
|
+
bash
|
146
|
+
Copy
|
147
|
+
Edit
|
148
|
+
git push origin my-new-feature
|
149
|
+
Open a pull request on GitHub.
|
150
|
+
License
|
151
|
+
This gem is open-source and available under the MIT License.
|
152
|
+
|
153
|
+
Additional Resources
|
154
|
+
My Country Mobile
|
155
|
+
Phone Number Generator Tool
|
156
|
+
Ruby Gems Documentation
|
157
|
+
HTTParty Documentation
|
158
|
+
Contact
|
174
159
|
For support or questions, reach out at:
|
175
|
-
|
176
|
-
|
177
|
-
|
160
|
+
|
161
|
+
Email: info@mycountrymobile.com
|
162
|
+
Website: My Country Mobile
|
163
|
+
yaml
|
164
|
+
Copy
|
165
|
+
Edit
|
178
166
|
|
179
167
|
---
|
180
168
|
|
181
|
-
### **
|
182
|
-
1. **
|
183
|
-
-
|
184
|
-
2. **
|
185
|
-
-
|
186
|
-
3. **
|
187
|
-
-
|
188
|
-
4. **Additional Resources**:
|
189
|
-
- Links to related tools and documentation.
|
190
|
-
5. **Professional Layout**:
|
191
|
-
- Easy to read with clear sections and formatting.
|
192
|
-
|
193
|
-
---
|
169
|
+
### **What’s New in This README**
|
170
|
+
1. **Added a Dedicated Section for "Phone Number Generator Tool":**
|
171
|
+
- Highlights the external tool link.
|
172
|
+
2. **Enhanced Layout:**
|
173
|
+
- Made it easier to navigate for new users.
|
174
|
+
3. **Emphasized Error Handling and Example Application:**
|
175
|
+
- Demonstrates real-world usage and API capabilities.
|