lightspeed_ruby 0.1.4 → 0.1.5

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: 99c19349a0b1ae4455685c1725d8d8dffedc43a7
4
- data.tar.gz: 33663fccc4c8bb1a93d1497d176764f29545cbbb
3
+ metadata.gz: 24292e2be0e108391527b5a082702ed2469972ca
4
+ data.tar.gz: 200dca39d1a5bddb8ab0062e196bcbd73993a508
5
5
  SHA512:
6
- metadata.gz: 7480af20b6955a1d385b4559878602e063a0ffdbf76d021d93cc6663fcd157e32aab921118376a6d9c95fec0fda72c73de0a3f84c64e6098277e52a9d0e8b042
7
- data.tar.gz: 69a5263c9fbb6a84e91a7c0a91eefd5b7e57d44cc69bd0a2375860a42d8867b049704bfba45cf0469211d0070971f17d51d083fc4824429801563877803c2abc
6
+ metadata.gz: ba1fb6f34da8fc8035f95e0acb4d7228d533a74ac7fee632783078eb93cd577b6e4b395fd034c9655c6af555b5e2eeca56d740e9c3c40fad20d8f09dc3144943
7
+ data.tar.gz: fec09d4ad79081243c3cf0e84632f5c0806ef50ec20a74a48068012ae4fa163b12a8b55c319f58ee44d0502c863b7a6597c32b38d9e9c48ae25a714f230db794
data/README.md CHANGED
@@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'lightspeed'
12
+ gem "lightspeed_ruby", require: "lightspeed"
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -18,17 +18,35 @@ And then execute:
18
18
 
19
19
  Or install it yourself as:
20
20
 
21
- $ gem install lightspeed
21
+ $ gem install lightspeed_ruby
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ Lightspeed ruby follows a namespacing pattern, in which every layer of the
26
+ Lightspeed's API creates a new namespace.
26
27
 
27
- ## Development
28
+ ### Items
28
29
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+ **Find an item**
30
31
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+ ```ruby
33
+ client.items.find("20")
34
+ ```
35
+
36
+ **Create an item**
37
+
38
+ ```ruby
39
+ client.items.create(description: "blah blah", itemType: "non_inventory")
40
+ ```
41
+
42
+ ### Relations
43
+
44
+ Whenever the API allows it, you can ask for certain relations to be sideloaded.
45
+ For example, you may wish to get the category of an item.
46
+
47
+ ```ruby
48
+ client.items.find("20", with: [:category])
49
+ ```
32
50
 
33
51
  ## Contributing
34
52
 
@@ -13,6 +13,10 @@ module Lightspeed
13
13
  client.post("Account/#{client.account_id}/Item.json", body: attributes).body
14
14
  end
15
15
 
16
+ def archive(item_id)
17
+ client.delete("Account/#{client.account_id}/Item/#{item_id}.json").body
18
+ end
19
+
16
20
  private
17
21
 
18
22
  attr_reader :client
@@ -9,6 +9,10 @@ module Lightspeed
9
9
 
10
10
  def sale_lines; API::Sales::SaleLines.new(client); end
11
11
 
12
+ def find(sale_id, with: [])
13
+ client.get("Account/#{client.account_id}/Sale/#{sale_id}.json", relations: with).body
14
+ end
15
+
12
16
  private
13
17
 
14
18
  attr_reader :client
@@ -28,6 +28,10 @@ module Lightspeed
28
28
  conn.post(url, body)
29
29
  end
30
30
 
31
+ def delete(url)
32
+ conn.delete(url)
33
+ end
34
+
31
35
  def accounts; API::Accounts.new(self); end
32
36
  def sales; API::Sales.new(self); end
33
37
  def customers; API::Customers.new(self); end
@@ -1,3 +1,3 @@
1
1
  module Lightspeed
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightspeed_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zamith
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-26 00:00:00.000000000 Z
11
+ date: 2017-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler