Billplz
Ruby gem to interface with the Billplz API
Install / Use
/learn @syamilmj/BillplzREADME
Billplz
An abstraction library to interface with the Billplz API
Installation
Add this line to your application's Gemfile:
gem 'billplz'
And then execute:
$ bundle
Or install it yourself as:
$ gem install billplz
Usage
Configuration
You may store your Billplz configuration during initialization:
# config/initializers/billplz.rb
Billplz.configure do |config|
config.api_key = ENV['BILLPLZ_API_KEY']
end
All the options above can be overridden during runtime:
Billplz.configuration.api_key = 'your-api-key'
Or, as a hash:
Billplz.configuration = { api_key: 'your-api-key' }
Collection
Create a new collection:
collection = Billplz::Collection.new({ title: 'My awesome collection' })
collection.create
Bill
Create a new bill:
bill = Billplz::Bill.new({ collection_id: VALID_COLLECTION_ID, ... })
bill.create
Get a bill:
bill = Billplz::Bill.new({ bill_id: 'abc123'})
bill = bill.get
# state (due, overdue and paid)
bill['state']
# paid (return false for due and overdue bill; true for paid bill)
bill['paid']
Delete a bill:
bill = Billplz::Bill.new({ bill_id: 'abc123'})
bill.delete
Response
Standard Net::HTTP response will be returned by all of the above methods. However, the gem packed a few helper methods to make your life easier:
#success?
You can check for a successfull request using success?, example:
bill.success?
#parsed_json
A convenient helper to parse the JSON response from the API, example:
bill_id = bill.parsed_json['id']
Development
Run rake test to run the unit tests.
Running rake test:remote will run tests that perform actual communication with the API server. Proceed with caution.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/tideee/billplz. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
