Sha256: daf840472019459778ce13a3c28fae23a0e28e5e7f836d1baad1c73c1026fa05

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

Item
===

An item is a concrete record. It can be part of a collection.

You can access data by using dot operator `item.name_of_attribte_you_wanna_access`.

Sometimes data gets converted when accessed. For example parseable dates will be returned as Date or DateTime.

## Setter

An item proxy contains setter methods, in order to set/change values.

```
  record = Feedback.find(id: 'z12f-3asm3ngals') #<LHS::Data @_proxy=#<LHS::Item>>
  rcord.recommended = false
```

## Build

Build and persist new items from scratch.

```ruby
feedback = Feedback.build(recommended: true)
feedback.save
```

## Save

You can persist changes like you would usually do with `save`.
`save` will return false if persisting fails. `save!` instead will raise an exception.

```ruby
  feedback = Feedback.find('1z-5r1fkaj')
  feedback.recommended = false
  feedback.save
```

## Update

`update` will return false if persisting fails. `update!` instead will an raise exception.

```ruby
feedback = Feedback.find('1z-5r1fkaj')
feedback.update(recommended: false)
```

## Destroy

You can delete records remotely by calling `destroy` on an item.

```ruby
  feedback = Feedback.find('1z-5r1fkaj')
  feedback.destroy
```

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lhs-1.3.1 docs/items.md
lhs-1.3.0 docs/items.md
lhs-1.2.3 docs/items.md
lhs-1.2.2 docs/items.md
lhs-1.2.1 docs/items.md
lhs-1.2.0 docs/items.md
lhs-1.1.0 docs/items.md
lhs-1.0.0 docs/items.md
lhs-0.4.0 docs/items.md
lhs-0.3.0 docs/items.md