Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theodorton/digipost-api-ruby
Simple API for sending messages through DigiPost
https://github.com/theodorton/digipost-api-ruby
Last synced: 28 days ago
JSON representation
Simple API for sending messages through DigiPost
- Host: GitHub
- URL: https://github.com/theodorton/digipost-api-ruby
- Owner: theodorton
- Created: 2011-10-29T20:31:38.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-05T13:27:14.000Z (over 12 years ago)
- Last Synced: 2023-04-10T00:17:21.193Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 113 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ruby API for Digipost from Posten
Simple Ruby API for sending messages through Digipost from The Norwegian Postal Service (Posten).
## Getting started
### Prerequisites
* An account with Digipost
* A private key for sending messages### Configuration
````ruby
user_id = 12345 #
certificate = '' # Not needed for now
private_key = File.new('path/to/your/private_key').read
Digipost::Service.configure(user_id, certificate, private_key)
````### Sending messages
````ruby
# Prepare message
message = Digipost::Api::Representations::Message.new
message.recipient = "digipost-user#1235"
message.subject = "Hi there!"
message.authentication_level = 'PASSWORD' # or 'TWO_FACTOR'
message.sms_notification = false # or true
message.date = Time.now
message.pdf = File.read('path/to/your/pdf_file')# Send the message
service = Digipost::Service.new
service.send_message(message)
````And that should be about it :)
## How to contribute
1. Fork this project
2. `bundle install`
3. `bundle exec rspec spec/**/*_spec.rb`
4. Add your features, please add specs for it
5. Request a pull request