braintree/braintree_ios — pull request #50 by mickeyreiss (2014-09-22 20:33:25+00:00)
Title: Introduce request objects for complex parameters

The goal of this change is to make our `saveCard` and `tokenizeCard` methods more flexible and accept whatever parameters merchants are interested in submitting, without bloating the public API.

I introduce a new class `BTClientCardRequest` to collect the various card details, like `NSURLComponents`. This class knows how to serialize itself into a format that the Gateway accepts in API requests under `credit_cards`.

After this change, tokenization including CVV looks like this:

```objcc
Braintree *braintree = [Braintree braintreeWithClientToken:CLIENT_TOKEN];
BTClientCardRequest *request = [[BTClientCardRequest alloc] init];
request.number = self.cardNumberField.text;
request.expirationMonth = self.expirationMonthField.text;
request.expirationYear = self.expirationYearField.text;

[braintree tokenizeCard:request
completion:^(NSString *nonce, NSError *error){
// Do something with nonce or error
}];
```

Follow on work would do something similar to the other `BTClient` methods, such as `savePayPal`, etc.

Note: This PR should solve #45 for @sergey-sportsetter.