lightspeed_restaurant 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98acf4895da81101922c4be885cc2065548170d8
4
- data.tar.gz: 590ae835a6762d0567044929acbf4d59e3776a2c
3
+ metadata.gz: 18eb9ef7e7bb62d418c019eafb350c64741007eb
4
+ data.tar.gz: aedde8a60516a595b7cf8e9193b145f963f2cf79
5
5
  SHA512:
6
- metadata.gz: dd7d93ef97e8ee8198fb063a4e870ec17b2ad13634f093fb34d444134e51257115f146c5f94774d2bb47de108d15f9c06602946c5d072b1541ba52870a2a6a1e
7
- data.tar.gz: 23197eed9f4e5daaf7446f52b9f4ed77f74461f7f47e9a3f39dda8a3eae41c348063576a7ec16215c9debb0f19b021b1a3e2c96c61b2b9551ff2ca6df3f9b550
6
+ metadata.gz: 0eb2e4d62b5a10c1eacd2853862db17e69448ed345a7e433ce3bd89019914933c160c55fe669cecf54b1b0ef24502feaffba0a9a633d4991c27b1cfb7dad346e
7
+ data.tar.gz: 6e3c6bd3b8f8fe340dfb13d90972137f8c1a64a06017284cd9e3be42f8aa08f76cb84ff45b955328aa61299620b18baec96ce243f49955f687bead3791b47cf2
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Circle CI](https://circleci.com/gh/chronogolf/lightspeed_restaurant.svg?style=shield&circle-token=94ebc6c7495f5c0bbf9f6a89526395306f223b7e)](https://circleci.com/gh/chronogolf/lightspeed_restaurant) [![Dependency Status](https://gemnasium.com/chronogolf/lightspeed_restaurant.svg)](https://gemnasium.com/chronogolf/lightspeed_restaurant) [![Code Climate](https://codeclimate.com/github/chronogolf/lightspeed_restaurant/badges/gpa.svg)](https://codeclimate.com/github/chronogolf/lightspeed_restaurant)
1
+ [![Circle CI](https://circleci.com/gh/chronogolf/lightspeed_restaurant.svg?style=shield&circle-token=94ebc6c7495f5c0bbf9f6a89526395306f223b7e)](https://circleci.com/gh/chronogolf/lightspeed_restaurant) [![Dependency Status](https://gemnasium.com/chronogolf/lightspeed_restaurant.svg)](https://gemnasium.com/chronogolf/lightspeed_restaurant) [![Code Climate](https://codeclimate.com/github/chronogolf/lightspeed_restaurant/badges/gpa.svg)](https://codeclimate.com/github/chronogolf/lightspeed_restaurant) [![Gem Version](https://badge.fury.io/rb/lightspeed_restaurant.svg)](https://badge.fury.io/rb/lightspeed_restaurant)
2
2
 
3
3
  # Lightspeed Restaurant API Client
4
4
 
@@ -58,6 +58,11 @@ LightspeedRestaurant::Customer.create(...firstName: 'Tom', email: 'tom@brady.com
58
58
 
59
59
  #### Update
60
60
  ```ruby
61
+ LightspeedRestaurant::Customer.update(123, { email: 'tom@brady.com' })
62
+ ```
63
+
64
+ #### Save
65
+ ```ruby
61
66
  customer = LightspeedRestaurant::Customer.find(123)
62
67
  customer.firstName = 'Micheal'
63
68
  customer.save
@@ -66,7 +71,7 @@ customer.save
66
71
  #### Destroy
67
72
  ```ruby
68
73
  customer = LightspeedRestaurant::Customer.find(123)
69
- customer.desroy
74
+ customer.destroy
70
75
  ```
71
76
 
72
77
  ## Contributing
@@ -81,7 +86,6 @@ Pull requests are welcome on GitHub at https://github.com/chronogolf/lightspeed_
81
86
  Find more informations at http://www.chronogolf.com/solutions
82
87
 
83
88
  ## Future Improvements
84
- - Improve update operation to handle update by passing a hash
85
89
  - Improve destroy operation to handle destroy by passing an ID (or an array of IDs)
86
90
  - Add missing resources (Company, Reservation, Floor, Table...)
87
91
  - Improve test coverage
@@ -3,11 +3,13 @@ require 'lightspeed_restaurant/operations/list'
3
3
  require 'lightspeed_restaurant/operations/find'
4
4
  require 'lightspeed_restaurant/operations/create'
5
5
  require 'lightspeed_restaurant/operations/update'
6
+ require 'lightspeed_restaurant/operations/save'
6
7
 
7
8
  module LightspeedRestaurant
8
9
  class Customer < LightspeedRestaurant::Base
9
- include LightspeedRestaurant::Operations::Update
10
+ include LightspeedRestaurant::Operations::Save
10
11
  extend LightspeedRestaurant::Operations::Create
12
+ extend LightspeedRestaurant::Operations::Update
11
13
  extend LightspeedRestaurant::Operations::Find
12
14
  extend LightspeedRestaurant::Operations::List
13
15
 
@@ -0,0 +1,10 @@
1
+ module LightspeedRestaurant
2
+ module Operations
3
+ module Save
4
+ def save
5
+ LightspeedRestaurant.put(self.class.resource_path + "/#{id}", self)
6
+ self
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,11 +1,11 @@
1
1
  module LightspeedRestaurant
2
2
  module Operations
3
3
  module Update
4
- def update
5
- LightspeedRestaurant.put(self.class.resource_path + "/#{id}", self)
6
- self
4
+ def update(id, attributes)
5
+ updated_object = new(attributes)
6
+ LightspeedRestaurant.put(resource_path + "/#{id}", updated_object)
7
+ updated_object
7
8
  end
8
- alias_method :save, :update
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module LightspeedRestaurant
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightspeed_restaurant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Buffon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -171,6 +171,7 @@ files:
171
171
  - lib/lightspeed_restaurant/operations/destroy.rb
172
172
  - lib/lightspeed_restaurant/operations/find.rb
173
173
  - lib/lightspeed_restaurant/operations/list.rb
174
+ - lib/lightspeed_restaurant/operations/save.rb
174
175
  - lib/lightspeed_restaurant/operations/update.rb
175
176
  - lib/lightspeed_restaurant/request.rb
176
177
  - lib/lightspeed_restaurant/version.rb