weixin_39630048
2020-12-09 14:09 阅读 0

Webhook Handlers

Adds an API to simplify the handling of webhook requests.

Example usage:

 ruby
notification = Recurly::Webhook.parse(xml_body)

case notification
when Recurly::Webhook::NewAccountNoficiation

  # A new account was created
  puts "New account #{notification.account.account_code}"

when Recurly::Webhook::NewSubscriptionNotification

  # A new subscription was added
  puts "New subscription from #{notification.account.account_code}"

  # Notifications are not necessarily current. ! relation methods will
  # fetch the latest data
  puts "Current state #{notification.subscription!.state}"

when Recurly::Webhook::SubscriptionNotification

  # A subscription-related notification was sent
  puts "Generic subscription notification by #{notification.account!.account_code}"

end

该提问来源于开源项目:recurly/recurly-client-ruby

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

11条回答 默认 最新

  • weixin_39608394 weixin_39608394 2020-12-09 14:09

    Thanks , we're taking a look at it!

    点赞 评论 复制链接分享
  • weixin_39612877 weixin_39612877 2020-12-09 14:09

    This is kind of big but I still want to merge this. Are you still interested in having it merged?

    点赞 评论 复制链接分享
  • weixin_39612877 weixin_39612877 2020-12-09 14:09

    This is great work BTW

    点赞 评论 复制链接分享
  • weixin_39616071 weixin_39616071 2020-12-09 14:09

    Any plans to merge this in and release?

    点赞 评论 复制链接分享
  • weixin_39612877 weixin_39612877 2020-12-09 14:09

    i'd need to review each field as it was written about a year ago. appears to have abandoned it. If you want to pick up the torch I would be happy to get it merged. All that's needed it to go through and update all the specs and fields to make sure they are current.

    点赞 评论 复制链接分享
  • weixin_39616071 weixin_39616071 2020-12-09 14:09

    what do you mean review each field?

    I forked the recurly repo and cherry picked the relevant commits and only one test failed, but looks like its not related to this pull request.

    
    Finished tests in 0.932608s, 264.8487 tests/s, 464.2894 assertions/s.
    
      1) Failure:
    test_0001_must_filter_sensitive_data_only_on_number_and_verification_value(Recurly::XML::.filter) [/Users/dave/Documents/scout/workspace/recurly-client-ruby/spec/recurly/xml_spec.rb:28]:
    --- expected
    +++ actual
    @@ -1 +1 @@
    -"<account><billing_info><number></number></billing_info></account>"
    +"<account><billing_info><number></number></billing_info></account>"
    
    
    247 tests, 433 assertions, 1 failures, 0 errors, 0 skips
    
    点赞 评论 复制链接分享
  • weixin_39612877 weixin_39612877 2020-12-09 14:09

    I'm unsure if any fields have changed or been added on our end since the time it was written.

    点赞 评论 复制链接分享
  • weixin_39612877 weixin_39612877 2020-12-09 14:09

    Would have to be checked here: https://recurly.readme.io/v2.0/page/webhooks

    点赞 评论 复制链接分享
  • weixin_39616071 weixin_39616071 2020-12-09 14:09

    I don't have the bandwidth right now to check for you, but speaking from a soon to be paying customer, it would be helpful is this was merged in.

    点赞 评论 复制链接分享
  • weixin_39612877 weixin_39612877 2020-12-09 14:09

    I'll see if I can prioritize it

    点赞 评论 复制链接分享
  • weixin_39612877 weixin_39612877 2020-12-09 14:09

    Had some time this morning. Let's finish the conversation here: https://github.com/recurly/recurly-client-ruby/pull/217

    点赞 评论 复制链接分享

相关推荐