luna_api 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ module LunaApi
2
+ class Inventory
3
+ class InventoryError < StandardError;end
4
+
5
+ def self.update(id, change=-1)
6
+ response = LunaApi::Request.put("http://inventory.lunasandals.com/inventory-change", :params => {:sku => id, change: change ||= -1})
7
+ handle_response(response)
8
+ end
9
+
10
+ private
11
+
12
+ def self.handle_response(response)
13
+ if response.success?
14
+ response.body
15
+ else
16
+ raise InventoryError, response.body
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module LunaApi
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/luna_api.rb CHANGED
@@ -10,3 +10,4 @@ require "luna_api/request"
10
10
  require "luna_api/store"
11
11
  require "luna_api/todo"
12
12
  require "luna_api/sale"
13
+ require "luna_api/inventory"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luna_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-10 00:00:00.000000000 Z
12
+ date: 2013-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus
@@ -41,6 +41,7 @@ files:
41
41
  - README.md
42
42
  - Rakefile
43
43
  - lib/luna_api.rb
44
+ - lib/luna_api/inventory.rb
44
45
  - lib/luna_api/request.rb
45
46
  - lib/luna_api/sale.rb
46
47
  - lib/luna_api/store.rb