Class: FakeBraintree::Subscription

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/fake_braintree/subscription.rb

Instance Method Summary collapse

Methods included from Helpers

#gzip, #gzipped_response, #md5

Constructor Details

#initialize(request) ⇒ Subscription

Returns a new instance of Subscription.



5
6
7
# File 'lib/fake_braintree/subscription.rb', line 5

def initialize(request)
  @subscription_hash = Hash.from_xml(request.body).delete("subscription")
end

Instance Method Details

#response_hashObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fake_braintree/subscription.rb', line 9

def response_hash
  response_hash = {}
  response_hash["id"]                = md5("#{@subscription_hash["payment_method_token"]}#{Time.now.to_f}")[0,6]
  response_hash["transactions"]      = []
  response_hash["add_ons"]           = []
  response_hash["discounts"]         = []
  response_hash["next_billing_date"] = 1.month.from_now
  response_hash["status"]            = Braintree::Subscription::Status::Active

  response_hash
end