README.md in fmrest-0.9.0 vs README.md in fmrest-0.10.0

- old
+ new

@@ -118,10 +118,11 @@ `:log` | Log JSON responses to STDOUT | Boolean | `false` `:coerce_dates` | See section on [date fields](#date-fields) | Boolean \| `:hybrid` \| `:full` | `false` `:date_format` | Date parsing format | String (FM date format) | `"MM/dd/yyyy"` `:timestamp_format` | Timestmap parsing format | String (FM date format) | `"MM/dd/yyyy HH:mm:ss"` `:time_format` | Time parsing format | String (FM date format) | `"HH:mm:ss"` +`:timezone` | The timezone for the FM server | `:local` \| `:utc` \: `nil` | `nil` ### Default connection settings If you're only connecting to a single FM database you can configure it globally through `FmRest.default_connection_settings=`. E.g.: @@ -268,23 +269,45 @@ a DSL in model classes). ### Hybrid string/date objects `FmRest::StringDate` and `FmRest::StringDateTime` are special classes that -inherit from `String`, but internally parse and store a `Date`/`DateTime` -(respectively), and delegate any methods not provided by `String` to those -objects. In other words, they quack like a duck *and* bark like a dog. +inherit from `String`, but internally parse and store a `Date` or `DateTime`, +and delegate any methods not provided by `String` to those objects. In other +words, they quack like a duck *and* bark like a dog. You can use these when you want fmrest-ruby to provide you with date objects, but you don't want to worry about date coercion of false positives (i.e. a string field that gets converted to `Date` because it just so matched the given date format). Be warned however that these classes come with a fair share of known gotchas -(see GitHub wiki for more info). +(see GitHub wiki for more info). Some of those gothas can be removed by calling +```ruby +FmRest::StringDateAwareness.enable +``` +Which will extend the core `Date` and `DateTime` classes to be aware of +`FmRest::StringDate`, especially when calling `Date.===`, `Date.parse` or +`Date._parse`. + +If you're working with ActiveRecord models this will also make them accept +`FmRest::StringDate` values for date fields. + +### Timezones + +fmrest-ruby has basic timezone support. You can set the `:timezone` option in +your connection settings to one of the following values: + +* `:local` - dates will be converted to your system local time offset (as + defined by `ENV["TZ"]`), or the timezone set by `Time.zone` if you're using + ActiveSupport +* `:utc` - dates will be converted to UTC offset +* `nil` - (default) ignore timezones altogether + + ## Spyke support (ActiveRecord-like ORM) [Spyke](https://github.com/balvig/spyke) is an ActiveRecord-like gem for building REST models. fmrest-ruby has Spyke support out of the box, although Spyke itself is not a dependency of fmrest-ruby, so you'll need to add it to @@ -318,20 +341,9 @@ `FmRest::Spyke` already included: ```ruby class Honeybee < FmRest::Spyke::Base end -``` - -In this case you can pass the [`fmrest_config`](#modelfmrest_config) hash as an -argument to `Base()`: - -```ruby -class Honeybee < FmRest::Spyke::Base(host: "...", database: "...", username: "...", password: "...") -end - -Honeybee.fmrest_config -# => { host: "...", database: "...", username: "...", password: "..." } ``` All of Spyke's basic ORM operations work: ```ruby