Sha256: 962c0ee5abcf5efb59e10b26652f2bfd3f214bfd5013b09666b15992bcb19759

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

require File.dirname(__FILE__) + '/../../lib/mousetrap'
require 'yaml'
require 'activesupport'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/../support/**/*.rb"].each {|f| require f}

settings = YAML.load_file(File.dirname(__FILE__) + '/settings.yml')
Mousetrap.authenticate(settings['user'], settings['password'])
Mousetrap.product_code = settings['product_code']



all_customers = Mousetrap::Customer.all
puts all_customers.inspect
puts all_customers.to_yaml

all_customers.each { |c| c.destroy }

all_customers = Mousetrap::Customer.all
puts all_customers.inspect
puts all_customers.to_yaml

__END__

code = 'maasdxgliu@example.com'
c = Mousetrap::Customer[code]
puts c.to_yaml
c.destroy

puts '-' * 80
c = Mousetrap::Customer[code]
puts c.to_yaml





email = random_email_address
attributes = {
  'code' => email,
  'firstName' => 'Example',
  'lastName' => 'Customer',
  'email' => email,
  'subscription' => {
      'planCode' => 'TEST',
      'ccFirstName' => 'Jon',
      'ccLastName' => 'Larkowski',
      'ccNumber' => '4111111111111111',
      'ccExpiration' => '12-2012',
      'ccZip' => '90210'
  }
}

customer = Mousetrap::Customer.create attributes
puts customer




puts Mousetrap::Plan.all.to_yaml
puts Mousetrap::Customer['maasdxgliu@example.com'].to_yaml
puts Mousetrap::Plan['TEST'].to_yaml
puts Mousetrap::Customer.all.to_yaml


customers_hash = Mousetrap::Customer['maasdxgliu@example.com']
customer_hash = customers_hash['customers']['customer'].slice 'firstName', 'lastName', 'email', 'code'
customer = Mousetrap::Customer.new customer_hash

customer.first_name = random_string
puts customer.save!

customer_hash = Mousetrap::Customer['maasdxgliu@example.com']
puts customer_hash.to_yaml

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hashrocket-mousetrap-0.2.0 spec/integration/smoke_test.rb