Finishes the two gaps that mattered most for real use: Invoices#create
(POST invoices) + Invoices#quote (POST invoices/{id}/quote, returning
the new Quote model with the actual payable bolt11 — an invoice alone
has nothing payable until quoted) and Webhook.valid_signature?
(HMAC-SHA256 over the raw body via X-Webhook-Signature, per Strike's own
documented reference implementation, timing-safe compare). Also finishes
Invoices#find (was a stub with a leftover binding.pry) and adds
WebhookEvent to parse the {id, eventType, data: {entityId, changes}}
payload shape — deliberately doesn't expose changed values, since
Strike's webhooks never carry them; a real value only ever comes from
re-fetching the resource.
Client gains #post/#patch (only #get existed before), needed for both
of the above.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199wudpuAtkhouHKSEGxzpa
StrikeMe::API
This is a ruby gem to interact with the strike.me API. It is an inition proof of concept implementation. As a reference, the documentation of the Strike API
Installation
TODO: Replace strike_me-api with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
Install the gem and add to the application's Gemfile by executing:
bundle add strike_me-api
If bundler is not being used to manage dependencies, install the gem by executing:
gem install strike_me-api
Playground
To play around with this api you can start a REPL using one of the following commands from the project's root:
pry -r strike_me/api
# or
irb -I lib -r strike_me/api
Then type code like:
account = StrikeMe::API::Account.new
account.profile.attributes
account.balances.map(&:attributes) # same as account.balances.to_a
account.balances.btc # to get the BTC specific one
invoices = StrikeMe::API::Invoices.new
invoices.any?
Usage
TODO: Write usage instructions here, for now, look at Playground
Development
After 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.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://gitlab.com/benja-2/strike_me-api.
License
The gem is available as open source under the terms of the MIT License.