Files
strike_me-api/lib/strike_me/api.rb
T
bterkuileandClaude Sonnet 5 90ab7c74b1 Add invoice creation, quoting, and webhook signature verification
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
2026-09-15 09:34:45 -05:00

38 lines
901 B
Ruby

# frozen_string_literal: true
require 'pry'
# External
require 'active_support/all'
require 'active_model'
require 'faraday'
# Internal
require_relative 'api/version'
require_relative 'btc'
require_relative 'btc_attribute_type'
# require_relative 'api/base_model'
# require_relative 'api/invoice_response'
ActiveSupport::Inflector.inflections(:en) { |inflect| inflect.acronym 'API' }
module StrikeMe
module API
class Error < StandardError; end
def self.autoload_default(name)
autoload name, "#{"#{self.name}/#{name}".underscore}.rb"
end
# autoload :InvoiceResponse, 'strike_me/api/invoice_response.rb'
autoload_default :Client
autoload_default :BaseClient
autoload_default :BaseModel
autoload_default :Account
autoload_default :Invoices
autoload_default :InvoiceResponse
autoload_default :Webhook
autoload_default :WebhookEvent
end
end