waynerobinson/xeroizer — pull request #44 by tjschuck (2012-11-26 20:05:47+00:00)
Title: Allow records to be created (built and saved) and updated in one step (pass hash of updated attributes and saved)

Adds ActiveRecord style `create` and `update_attributes` methods.

Instead of:

```ruby
contact = xero.Contact.build(:name => 'WR Inc.', :first_name => 'Wayne', :last_name => 'Robinson')
contact.save
```

can do one-liner:

```ruby
contact = xero.Contact.create(:name => 'WR Inc.', :first_name => 'Wayne', :last_name => 'Robinson')
```

Like AR, the resulting object is returned whether the object was saved successfully or not, so that you can check it with `contact.valid?` and see its errors with `contact.errors`.

And to update, instead of:

```ruby
contact.email_address = "wayne@example.com"
contact.default_currency = "NZD"
contact.save
```

you can do the one-liner:

```ruby
contact.update_attributes(:email_address => "wayne@example.com", :default_currency => "NZD")
```