xsys 0.0.23 → 0.0.24

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: e97630a059370af9c5826bf80e2b57ee60ea861b
4
- data.tar.gz: f70e0d4c7bb7861499cc1873a2e445aa952a4266
3
+ metadata.gz: a556bd6e2fb890961fecc634385a8a568ee15033
4
+ data.tar.gz: 6240111ab8af52e4a44b67df59abb32bafb66370
5
5
  SHA512:
6
- metadata.gz: 70a62718ad57be6ae1f08fe08f248b06cd7c0d74f1b807f48f84a324ec6e1441b324a74ec16eeac6164498887476723a77917516dc118fcb708c6092e7ddbb28
7
- data.tar.gz: b47341ba6f1adf0cf32c43a814c95ef21e6d1f42cddcebfbaabd67cd1ebdc069fba832f76c83f500d0101a54a17dea1a814428259903fb4d7bdb195cf7869c44
6
+ metadata.gz: 9d699561d86b53c1c435330cfa2e7755b6d6ddb1d5e7b6975f0b1a9daccf56e2cd3d36d09c4070e072d089f91e3a743b5feb120bc100828bbcd80b901d28c9b1
7
+ data.tar.gz: cf2ee7fad43aeb1814f7e4bcef13e39db64ddcd6bccd803e4617ea0a43ac58d396d4266b51f6bdb7fb41e40ba5add2a138f841ef31ed215858d18998a8355347
data/CHANGELOG.md CHANGED
@@ -89,3 +89,7 @@
89
89
  ## v0.0.23
90
90
 
91
91
  * Cast transaction date to date
92
+
93
+ ## v0.0.24
94
+
95
+ * Added transaction methods
data/lib/xsys/api.rb CHANGED
@@ -125,6 +125,20 @@ module Xsys
125
125
  request.map { |r| Model::StockControlItem.new(r) }
126
126
  end
127
127
 
128
+ def self.get_transactions(params={})
129
+ request = get_request('/transactions', params)
130
+
131
+ request.map { |r| Model::Transaction.new(r) }
132
+ end
133
+
134
+ def self.get_transaction(params={})
135
+ request = get_request("/transactions/#{params[:id]}", {
136
+ shop_code: params[:shop_code]
137
+ })
138
+
139
+ Model::Transaction.new(request)
140
+ end
141
+
128
142
  def self.get_users
129
143
  get_request('/users').map { |r| Model::User.new(r) }
130
144
  end
@@ -0,0 +1,25 @@
1
+ module Xsys
2
+ module Model
3
+ class Transaction
4
+ attr_accessor :transaction_id, :shop_id, :transaction_kind_id,
5
+ :receipt_number, :product_id, :client_id, :workshop_id,
6
+ :product_provider_id, :transaction_status_id, :transaction_date,
7
+ :logical_section_id, :physical_section_id, :seller_id, :user_id,
8
+ :shop_code, :user, :items
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k,v|
12
+ if k.to_s == 'transaction_date'
13
+ self.transaction_date = Date.parse(v) unless v.nil?
14
+ elsif k.to_s == 'user'
15
+ self.user = User.new(v)
16
+ elsif k.to_s == 'items'
17
+ self.items = v.map { |x| TransactionItem.new(x) }
18
+ else
19
+ self.send("#{k}=", v) if self.respond_to?(k)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ module Xsys
2
+ module Model
3
+ class TransactionItem
4
+ attr_accessor :product_id, :transaction_status_id,
5
+ :quantity, :remaining_quantity, :qa_flag, :qa_date,
6
+ :amount_total, :cost, :packages, :miles
7
+
8
+ def initialize(attributes={})
9
+ attributes.each do |k,v|
10
+ if k.to_s == 'transaction_date'
11
+ self.transaction_date = Date.parse(v) unless v.nil?
12
+ elsif k.to_s == 'user'
13
+ self.user = User.new(v)
14
+ elsif k.to_s == 'items'
15
+ self.items = v.map { |x| TransactionItem.new(x) }
16
+ else
17
+ self.send("#{k}=", v) if self.respond_to?(k)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
data/lib/xsys/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.0.23"
2
+ VERSION = "0.0.24"
3
3
  end
data/lib/xsys.rb CHANGED
@@ -15,6 +15,8 @@ require 'xsys/model/shop'
15
15
  require 'xsys/model/stock'
16
16
  require 'xsys/model/stock_control'
17
17
  require 'xsys/model/stock_control_item'
18
+ require 'xsys/model/transaction'
19
+ require 'xsys/model/transaction_item'
18
20
  require 'xsys/model/user'
19
21
 
20
22
  require 'xsys/api'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xsys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2014-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,6 +81,8 @@ files:
81
81
  - lib/xsys/model/stock.rb
82
82
  - lib/xsys/model/stock_control.rb
83
83
  - lib/xsys/model/stock_control_item.rb
84
+ - lib/xsys/model/transaction.rb
85
+ - lib/xsys/model/transaction_item.rb
84
86
  - lib/xsys/model/user.rb
85
87
  - lib/xsys/pagination.rb
86
88
  - lib/xsys/version.rb