Module: FakeBraintree::Helpers
- Included in:
- Address, CreditCard, Customer, Redirect, SinatraApp, Subscription
- Defined in:
- lib/fake_braintree/helpers.rb
Instance Method Summary collapse
- #create_id(merchant_id) ⇒ Object
- #gzip(content) ⇒ Object
- #gzipped_response(status_code, uncompressed_body) ⇒ Object
- #md5(content) ⇒ Object
Instance Method Details
#create_id(merchant_id) ⇒ Object
19 20 21 |
# File 'lib/fake_braintree/helpers.rb', line 19 def create_id(merchant_id) md5("#{merchant_id}#{Time.now.to_f}") end |
#gzip(content) ⇒ Object
7 8 9 |
# File 'lib/fake_braintree/helpers.rb', line 7 def gzip(content) ActiveSupport::Gzip.compress(content) end |
#gzipped_response(status_code, uncompressed_body) ⇒ Object
11 12 13 |
# File 'lib/fake_braintree/helpers.rb', line 11 def gzipped_response(status_code, uncompressed_body) [status_code, { 'Content-Encoding' => 'gzip' }, gzip(uncompressed_body)] end |
#md5(content) ⇒ Object
15 16 17 |
# File 'lib/fake_braintree/helpers.rb', line 15 def md5(content) Digest::MD5.hexdigest(content) end |