{"id":29705766,"url":"https://github.com/bigbinary/sns_sender","last_synced_at":"2025-07-23T15:08:50.137Z","repository":{"id":289086915,"uuid":"970097541","full_name":"bigbinary/sns_sender","owner":"bigbinary","description":"Ruby gem to send messages to an SNS topic","archived":false,"fork":false,"pushed_at":"2025-04-22T05:02:16.000Z","size":10,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-04T09:51:43.487Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigbinary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-21T13:17:37.000Z","updated_at":"2025-04-21T13:25:36.000Z","dependencies_parsed_at":"2025-04-21T13:41:20.624Z","dependency_job_id":"e19764d7-1ef7-4e3f-9ed6-b32850f1f640","html_url":"https://github.com/bigbinary/sns_sender","commit_stats":null,"previous_names":["bigbinary/sns_sender"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bigbinary/sns_sender","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigbinary%2Fsns_sender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigbinary%2Fsns_sender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigbinary%2Fsns_sender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigbinary%2Fsns_sender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigbinary","download_url":"https://codeload.github.com/bigbinary/sns_sender/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigbinary%2Fsns_sender/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266700031,"owners_count":23970616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-23T15:08:47.714Z","updated_at":"2025-07-23T15:08:50.120Z","avatar_url":"https://github.com/bigbinary.png","language":"Ruby","readme":"# SNS Sender\n\nA Ruby gem that provides a simple interface for publishing messages to AWS SNS topics, which can then be consumed by SQS queues.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'sns_sender'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install sns_sender\n\n## Configuration\n\nConfigure the gem with your AWS credentials. In a Rails application, you might want to put this in an initializer:\n\n```ruby\n# config/initializers/sns_sender.rb\nSnsSender.configure do |config|\n  config.aws_region = 'us-east-1'                    # Required\n  config.aws_access_key_id = 'YOUR_ACCESS_KEY'       # Required\n  config.aws_secret_access_key = 'YOUR_SECRET_KEY'   # Required\n  config.default_topic_arn = 'YOUR_DEFAULT_TOPIC_ARN' # Optional\nend\n```\n\nYou can also use environment variables for AWS credentials:\n- AWS_REGION\n- AWS_ACCESS_KEY_ID\n- AWS_SECRET_ACCESS_KEY\n\n## Usage\n\n### Basic Usage\n\n```ruby\n# Send a simple message\nSnsSender.publish(\n  topic_arn: 'arn:aws:sns:us-east-1:123456789012:MyTopic',\n  message: 'Hello, World!'\n)\n\n# Send a JSON message\nSnsSender.publish(\n  topic_arn: 'arn:aws:sns:us-east-1:123456789012:MyTopic',\n  message: {\n    event: 'user_created',\n    data: {\n      id: 123,\n      name: 'John Doe',\n      email: 'john@example.com'\n    }\n  }\n)\n\n# Using the default topic (if configured)\nSnsSender.publish(\n  message: 'Hello, World!'\n)\n\n# With message attributes\nSnsSender.publish(\n  topic_arn: 'arn:aws:sns:us-east-1:123456789012:MyTopic',\n  message: 'Hello, World!',\n  message_attributes: {\n    event_type: 'greeting',\n    priority: 'high'\n  }\n)\n```\n\n### Response Format\n\nThe `publish` method returns a hash with the following structure:\n\n```ruby\n{\n  success: true,\n  message_id: 'abc123...' # The SNS message ID\n}\n```\n\n### Error Handling\n\nThe gem can raise the following errors:\n\n```ruby\nbegin\n  SnsSender.publish(topic_arn: 'arn:...', message: 'Hello')\nrescue SnsSender::ConfigurationError =\u003e e\n  # Handle missing or invalid AWS configuration\nrescue SnsSender::PublishError =\u003e e\n  # Handle SNS publishing errors\nrescue ArgumentError =\u003e e\n  # Handle invalid arguments (missing topic_arn or message)\nend\n```\n\n## Development\n\nAfter 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.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/bigbinary/sns_sender.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigbinary%2Fsns_sender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigbinary%2Fsns_sender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigbinary%2Fsns_sender/lists"}