diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..50591e9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..da27bf1 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,26 @@ +name: Security Audit + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "0 6 * * 1" + +jobs: + codeql: + runs-on: ubuntu-latest + permissions: + security-events: write + + steps: + - uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ruby + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 diff --git a/.gitignore b/.gitignore index 0823d6e..291a1ff 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ Gemfile.lock *.swo *~ -# Claude / AI +# Local config .claude/ CLAUDE.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4ea8f0e..f515f67 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ Thank you for your interest in contributing to the kwtsms Ruby gem. 4. Run integration tests (requires API credentials): ```bash - RUBY_USERNAME=your_user RUBY_PASSWORD=your_pass bundle exec rake test_integration + RUBY_USERNAME=ruby_username RUBY_PASSWORD=ruby_password bundle exec rake test_integration ``` ## Branch Naming diff --git a/README.md b/README.md index 3c7f3e9..1b41b2c 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,28 @@ -# kwtsms +# kwtSMS Ruby Client [![Gem Version](https://badge.fury.io/rb/kwtsms.svg)](https://rubygems.org/gems/kwtsms) [![CI](https://github.com/boxlinknet/kwtsms-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/boxlinknet/kwtsms-ruby/actions/workflows/ci.yml) -[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) -[![Ruby](https://img.shields.io/badge/ruby-%3E%3D%202.7-red.svg)](https://www.ruby-lang.org/) +[![Security Audit](https://github.com/boxlinknet/kwtsms-ruby/actions/workflows/codeql.yml/badge.svg)](https://github.com/boxlinknet/kwtsms-ruby/actions/workflows/codeql.yml) +[![Ruby](https://img.shields.io/badge/Ruby-%3E%3D%202.7-red.svg)](https://www.ruby-lang.org/) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) -Official Ruby client library for the [kwtSMS](https://www.kwtsms.com) SMS gateway. Send SMS, check balance, validate phone numbers, check delivery status, and manage sender IDs. +Ruby client for the [kwtSMS API](https://www.kwtsms.com). Send SMS, check balance, validate numbers, list sender IDs, check coverage, get delivery reports. -Zero external runtime dependencies. Uses Ruby standard library only. +## About kwtSMS + +kwtSMS is a Kuwaiti SMS gateway trusted by top businesses to deliver messages anywhere in the world, with private Sender ID, free API testing, non-expiring credits, and competitive flat-rate pricing. Secure, simple to integrate, built to last. Open a free account in under 1 minute, no paperwork or payment required. [Click here to get started](https://www.kwtsms.com/signup/) + +## Prerequisites + +You need **Ruby** (>= 2.7) installed. + +### Check if Ruby is installed + +```bash +ruby -v +``` + +If not installed, see [ruby-lang.org/en/downloads](https://www.ruby-lang.org/en/downloads/). ## Install @@ -44,8 +59,8 @@ puts "msg-id: #{result['msg-id']}" if result["result"] == "OK" Create a `.env` file or set environment variables: ```ini -KWTSMS_USERNAME=your_api_user -KWTSMS_PASSWORD=your_api_pass +KWTSMS_USERNAME=ruby_username +KWTSMS_PASSWORD=ruby_password KWTSMS_SENDER_ID=YOUR-SENDER KWTSMS_TEST_MODE=1 KWTSMS_LOG_FILE=kwtsms.log @@ -55,8 +70,8 @@ KWTSMS_LOG_FILE=kwtsms.log ```ruby sms = KwtSMS::Client.new( - "your_api_user", - "your_api_pass", + "ruby_username", + "ruby_password", sender_id: "YOUR-SENDER", test_mode: true, log_file: "kwtsms.log" @@ -315,7 +330,7 @@ Before going live: Every API call is logged to a JSONL file (default: `kwtsms.log`): ```json -{"ts":"2026-03-06T12:00:00Z","endpoint":"send","request":{"username":"user","password":"***","mobile":"96598765432","message":"Hello"},"response":{"result":"OK","msg-id":"12345"},"ok":true,"error":null} +{"ts":"2026-03-06T12:00:00Z","endpoint":"send","request":{"username":"ruby_username","password":"***","mobile":"96598765432","message":"Hello"},"response":{"result":"OK","msg-id":"12345"},"ok":true,"error":null} ``` Passwords are always masked as `***`. Logging never crashes the main flow. diff --git a/examples/01_basic_usage.md b/examples/01_basic_usage.md index d804c64..b12ae06 100644 --- a/examples/01_basic_usage.md +++ b/examples/01_basic_usage.md @@ -11,8 +11,8 @@ gem install kwtsms Create a `.env` file with your credentials: ```ini -KWTSMS_USERNAME=your_api_user -KWTSMS_PASSWORD=your_api_pass +KWTSMS_USERNAME=ruby_username +KWTSMS_PASSWORD=ruby_password KWTSMS_SENDER_ID=YOUR-SENDER KWTSMS_TEST_MODE=1 ``` diff --git a/examples/01_basic_usage.rb b/examples/01_basic_usage.rb index a90cc54..721be0d 100644 --- a/examples/01_basic_usage.rb +++ b/examples/01_basic_usage.rb @@ -6,8 +6,8 @@ # gem install kwtsms # # Create a .env file: -# KWTSMS_USERNAME=your_api_user -# KWTSMS_PASSWORD=your_api_pass +# KWTSMS_USERNAME=ruby_username +# KWTSMS_PASSWORD=ruby_password # KWTSMS_SENDER_ID=YOUR-SENDER # KWTSMS_TEST_MODE=1 diff --git a/examples/04_rails_endpoint.md b/examples/04_rails_endpoint.md index d880bf4..0a9b48e 100644 --- a/examples/04_rails_endpoint.md +++ b/examples/04_rails_endpoint.md @@ -16,8 +16,8 @@ Demonstrates integrating kwtsms into a Ruby on Rails application. 3. Set environment variables (or use `.env` in development): ```ini - KWTSMS_USERNAME=your_api_user - KWTSMS_PASSWORD=your_api_pass + KWTSMS_USERNAME=ruby_username + KWTSMS_PASSWORD=ruby_password KWTSMS_SENDER_ID=YOUR-SENDER KWTSMS_TEST_MODE=0 ``` diff --git a/examples/README.md b/examples/README.md index 3e2495a..7fa50a7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -18,8 +18,8 @@ 2. Create a `.env` file: ```ini - KWTSMS_USERNAME=your_api_user - KWTSMS_PASSWORD=your_api_pass + KWTSMS_USERNAME=ruby_username + KWTSMS_PASSWORD=ruby_password KWTSMS_SENDER_ID=YOUR-SENDER KWTSMS_TEST_MODE=1 ``` diff --git a/test/test_client.rb b/test/test_client.rb index fbabd46..00c3e01 100644 --- a/test/test_client.rb +++ b/test/test_client.rb @@ -46,13 +46,13 @@ def teardown end def test_from_env_with_env_vars - ENV["KWTSMS_USERNAME"] = "testuser" - ENV["KWTSMS_PASSWORD"] = "testpass" + ENV["KWTSMS_USERNAME"] = "ruby_username" + ENV["KWTSMS_PASSWORD"] = "ruby_password" ENV["KWTSMS_SENDER_ID"] = "MY-SENDER" ENV["KWTSMS_TEST_MODE"] = "1" client = KwtSMS::Client.from_env - assert_equal "testuser", client.username + assert_equal "ruby_username", client.username assert_equal "MY-SENDER", client.sender_id assert client.test_mode end