lib/acumatica/stock_item.rb in acumatica-0.2.0 vs lib/acumatica/stock_item.rb in acumatica-0.2.1

- old
+ new

@@ -1,12 +1,14 @@ module Acumatica class StockItem < OpenStruct - def self.create(params) - Acumatica::Client.instance.connection.put do |req| + def self.create(params = {}) + response = Acumatica::Client.instance.connection.put do |req| req.url url req.body = params end + + self.new(response.body) end def self.find_all(select: nil, filter: nil, expand: nil, offset: nil, limit: nil) params = {} @@ -45,9 +47,9 @@ end private def methodify(word) - word.gsub(/(.)([A-Z])/,'\1_\2').downcase + word.gsub(/([a-z])([A-Z])|\s/,'\1_\2').downcase end end end