We don't have a sample in Ruby for Digital Goods, but we have one for Instant Buy that might be helpful https://developers.google.com/commerce/wallet/instant-buy/web/quickstart-ruby
Also take a look at the JWT Ruby Library https://github.com/progrium/ruby-jwt
We also have a link to a JWT decoder that will be helpful when testing your app. You can find it in the Digital Goods doc site under Resources --> Tools --> JWT Decoder