acumatica 0.2.1 → 0.3.0

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: b5390548880ffb766eca49f23356b9c5cda909a2
4
- data.tar.gz: 41bf04cd0c3d17bc7a6b5e3ae683aba296dfc324
3
+ metadata.gz: cb833db217b873db5acfe1406fb696fed3b13f02
4
+ data.tar.gz: ec61b48049ffed6c554e86683ccacc50a7b21e3b
5
5
  SHA512:
6
- metadata.gz: f1ce0f9c84c1af44e93d8c554a3626af9ce4e3fe5f7ed36285a485ff23f3ed0208d53fca709d9ca92f0010eee449b559f9d87cd8d9f39fe4e387884f9f31f51b
7
- data.tar.gz: a4f982f50116b8d3ecc8e12a3dfb67df6da10ebbe12f028298d94faea5271e3af8f0e3bda0d124b7a2785b7f8431778866676e84ef1bf248d1d2335ea8178a84
6
+ metadata.gz: 3866b4fa45d5371be35b3d3f78540d427a267903f6abf1b78152038f8389d8561f7f1e84d4821113bab9ee291488e315153318c85a51869b126e3d4e213dd567
7
+ data.tar.gz: 426d44d2311dda2c8cbddd3c27c017267a81595cb2c60927dc29076241a70d9a89ed5f5832e084d1feaa448664f1b5fb42cddecadd274edd9f155d3696bf8a2a
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require: rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.4
7
+
8
+
9
+ Metrics/BlockLength:
10
+ Exclude:
11
+ - acumatica.gemspec
12
+ - spec/**/*.rb
13
+
14
+ Metrics/LineLength:
15
+ Max: 100
16
+
17
+ Metrics/MethodLength:
18
+ Max: 15
19
+
20
+ Style/StringLiterals:
21
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,15 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-04-24 18:47:18 -0700 using RuboCop version 0.55.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 6
10
+ Style/Documentation:
11
+ Exclude:
12
+ - 'spec/**/*'
13
+ - 'lib/acumatica/client.rb'
14
+ - 'lib/acumatica/errors.rb'
15
+ - 'lib/acumatica/resource.rb'
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in acumatica.gemspec
6
8
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acumatica (0.2.1)
4
+ acumatica (0.3.0)
5
+ activesupport
5
6
  faraday
6
7
  faraday-cookie_jar
7
8
  faraday_middleware
@@ -10,17 +11,24 @@ PATH
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
14
+ activesupport (5.2.0)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 0.7, < 2)
17
+ minitest (~> 5.1)
18
+ tzinfo (~> 1.1)
13
19
  addressable (2.5.2)
14
20
  public_suffix (>= 2.0.2, < 4.0)
21
+ ast (2.4.0)
15
22
  byebug (10.0.0)
16
23
  coderay (1.1.2)
24
+ concurrent-ruby (1.0.5)
17
25
  crack (0.4.3)
18
26
  safe_yaml (~> 1.0.0)
19
27
  diff-lcs (1.3)
20
- domain_name (0.5.20170404)
28
+ domain_name (0.5.20180417)
21
29
  unf (>= 0.0.5, < 1.0.0)
22
30
  dotenv (2.2.2)
23
- faraday (0.14.0)
31
+ faraday (0.15.0)
24
32
  multipart-post (>= 1.2, < 3)
25
33
  faraday-cookie_jar (0.0.6)
26
34
  faraday (>= 0.7.4)
@@ -46,6 +54,8 @@ GEM
46
54
  hashdiff (0.3.7)
47
55
  http-cookie (1.0.3)
48
56
  domain_name (~> 0.5)
57
+ i18n (1.0.1)
58
+ concurrent-ruby (~> 1.0)
49
59
  json (2.1.0)
50
60
  listen (3.1.5)
51
61
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -53,15 +63,21 @@ GEM
53
63
  ruby_dep (~> 1.2)
54
64
  lumberjack (1.0.13)
55
65
  method_source (0.9.0)
66
+ minitest (5.11.3)
56
67
  multipart-post (2.0.0)
57
68
  nenv (0.3.0)
58
69
  notiffany (0.1.1)
59
70
  nenv (~> 0.1)
60
71
  shellany (~> 0.0)
72
+ parallel (1.12.1)
73
+ parser (2.5.1.0)
74
+ ast (~> 2.4.0)
75
+ powerpack (0.1.1)
61
76
  pry (0.11.3)
62
77
  coderay (~> 1.1.0)
63
78
  method_source (~> 0.9.0)
64
79
  public_suffix (3.0.2)
80
+ rainbow (3.0.0)
65
81
  rake (10.5.0)
66
82
  rb-fsevent (0.10.3)
67
83
  rb-inotify (0.9.10)
@@ -79,13 +95,27 @@ GEM
79
95
  diff-lcs (>= 1.2.0, < 2.0)
80
96
  rspec-support (~> 3.7.0)
81
97
  rspec-support (3.7.1)
98
+ rubocop (0.55.0)
99
+ parallel (~> 1.10)
100
+ parser (>= 2.5)
101
+ powerpack (~> 0.1)
102
+ rainbow (>= 2.2.2, < 4.0)
103
+ ruby-progressbar (~> 1.7)
104
+ unicode-display_width (~> 1.0, >= 1.0.1)
105
+ rubocop-rspec (1.25.1)
106
+ rubocop (>= 0.53.0)
107
+ ruby-progressbar (1.9.0)
82
108
  ruby_dep (1.5.0)
83
109
  safe_yaml (1.0.4)
84
110
  shellany (0.0.1)
85
111
  thor (0.20.0)
112
+ thread_safe (0.3.6)
113
+ tzinfo (1.2.5)
114
+ thread_safe (~> 0.1)
86
115
  unf (0.1.4)
87
116
  unf_ext
88
117
  unf_ext (0.0.7.5)
118
+ unicode-display_width (1.3.2)
89
119
  vcr (4.0.0)
90
120
  webmock (3.3.0)
91
121
  addressable (>= 2.3.6)
@@ -103,6 +133,8 @@ DEPENDENCIES
103
133
  guard-rspec
104
134
  rake (~> 10.0)
105
135
  rspec (~> 3.7.0)
136
+ rubocop (~> 0.55.0)
137
+ rubocop-rspec
106
138
  vcr
107
139
  webmock
108
140
 
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  guard :rspec, cmd: "bin/rspec" do
2
4
  require "guard/rspec/dsl"
3
5
  dsl = Guard::RSpec::Dsl.new(self)
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  This gem provides a wrapper for the [Acumatica REST API](https://help.acumatica.com/Main?ScreenId=ShowWiki&pageid=ca2716f1-025a-4a6e-9090-797cf32b0459).
4
4
 
5
+ ![Gem](https://img.shields.io/gem/v/acumatica.svg)
6
+ ![Travis](https://img.shields.io/travis/Jetbuilt/acumatica.svg)
7
+
5
8
  ## Installation
6
9
 
7
10
  Add this line to your application's Gemfile:
@@ -20,6 +23,8 @@ Or install it yourself as:
20
23
 
21
24
  ## Usage
22
25
 
26
+ ### Client
27
+
23
28
  ```
24
29
  acumatica = Acumatica::Client.configure do |config|
25
30
  config.url = "https://mycompany.acumatica.com"
@@ -27,8 +32,26 @@ acumatica = Acumatica::Client.configure do |config|
27
32
  config.password = "sekret"
28
33
  end
29
34
 
35
+ # Manually log in/out
30
36
  acumatica.login
37
+ acumatica.stock_items.find_all(limit: 1)
38
+ acumatica.logout
39
+
40
+ # Wrap calls in session to automatically log in/out
41
+ acumatica.session do
42
+ acumatica.stock_items.find_all(
43
+ select: 'Attributes,InventoryID',
44
+ filter: '',
45
+ offset: 0,
46
+ limit: 100,
47
+ expand: 'Attributes'
48
+ )
49
+ end
50
+ ```
51
+
52
+ ### StockItem
31
53
 
54
+ ```
32
55
  acumatica.stock_items.find_all(
33
56
  select: 'Attributes,InventoryID',
34
57
  filter: '',
@@ -47,18 +70,26 @@ acumatica.stock_items.create({
47
70
  }
48
71
  ]
49
72
  })
73
+ ```
50
74
 
51
- acumatica.logout
52
- ```
75
+ ### Customer
76
+
77
+ ```
78
+ acumatica.customers.find_all(limit: 1)
79
+ acumatica.customers.create(customer_id: "123", customer_name: "ACME", tax_zone: "TAXES!")
80
+ ```
53
81
 
54
82
  ## NOTES
55
- - Currently only querying and creating StockItems has been implemented - pull requests welcome!
56
- - Querying Acumatica can be very slow, account for that when designing your integration.
57
- - Some Acumatica installations limit the number of concurrent users, so make sure to logout when finished.
83
+ - This library is very much a work in progress - pull requests welcome!
84
+ - Querying Acumatica can be very slow, account for that when designing your integration. For
85
+ example, calling `find_all` on a resource without a limit may take minutes to complete the
86
+ request. YMMV.
87
+ - Some Acumatica installations limit the number of concurrent users, so make sure to logout when
88
+ finished or wrap calls with `Acumatica::Client#session`
58
89
 
59
90
  ## TODO
60
91
  - OAuth Authentication (coming soon)
61
- - Tests
92
+ - Document public methods
62
93
 
63
94
  ## Contributing
64
95
 
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
2
6
 
3
- begin
4
- require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:spec)
5
8
 
6
- RSpec::Core::RakeTask.new(:spec)
9
+ RuboCop::RakeTask.new
7
10
 
8
- task :default => :spec
9
- rescue LoadError
10
- # no rspec available
11
- end
11
+ task default: %i[spec rubocop]
data/acumatica.gemspec CHANGED
@@ -1,5 +1,7 @@
1
1
 
2
- lib = File.expand_path("../lib", __FILE__)
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path('lib', __dir__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require "acumatica/version"
5
7
 
@@ -9,7 +11,7 @@ Gem::Specification.new do |spec|
9
11
  spec.authors = ["Jared Moody"]
10
12
  spec.email = ["jared@jetbuilt.com"]
11
13
 
12
- spec.summary = %q{A wrapper for the acumatica API}
14
+ spec.summary = 'A wrapper for the acumatica API'
13
15
  spec.homepage = "https://github.com/jetbuilt/acumatica"
14
16
  spec.license = "MIT"
15
17
 
@@ -27,11 +29,14 @@ Gem::Specification.new do |spec|
27
29
  spec.add_development_dependency "guard-rspec"
28
30
  spec.add_development_dependency "rake", "~> 10.0"
29
31
  spec.add_development_dependency "rspec", "~> 3.7.0"
32
+ spec.add_development_dependency "rubocop", "~> 0.55.0"
33
+ spec.add_development_dependency 'rubocop-rspec'
30
34
  spec.add_development_dependency "vcr"
31
35
  spec.add_development_dependency "webmock"
32
36
 
37
+ spec.add_dependency "activesupport"
33
38
  spec.add_dependency "faraday"
34
- spec.add_dependency "faraday_middleware"
35
39
  spec.add_dependency "faraday-cookie_jar"
40
+ spec.add_dependency "faraday_middleware"
36
41
  spec.add_dependency "json"
37
42
  end
data/bin/console CHANGED
@@ -1,12 +1,21 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "dotenv/load"
6
+ require "byebug"
5
7
  require "acumatica"
6
8
 
7
9
  # You can add fixtures and/or initialization code here to make experimenting
8
10
  # with your gem easier. You can also use a different console, if you like.
9
11
 
12
+ @acumatica = Acumatica::Client.configure do |config|
13
+ config.url = ENV['ACUMATICA_URL']
14
+ config.name = ENV['ACUMATICA_USER']
15
+ config.password = ENV['ACUMATICA_PASSWORD']
16
+ config.debug = true
17
+ end
18
+
10
19
  # (If you use this, don't forget to add pry to your Gemfile!)
11
20
  # require "pry"
12
21
  # Pry.start
data/bin/guard CHANGED
@@ -10,12 +10,12 @@
10
10
 
11
11
  require "pathname"
12
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
13
+ Pathname.new(__FILE__).realpath)
14
14
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
data/bin/rspec CHANGED
@@ -10,12 +10,12 @@
10
10
 
11
11
  require "pathname"
12
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
13
+ Pathname.new(__FILE__).realpath)
14
14
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
data/lib/acumatica.rb CHANGED
@@ -1,9 +1,11 @@
1
- require "faraday"
2
- require "faraday_middleware"
3
- require "faraday-cookie_jar"
4
- require "ostruct"
5
- require "singleton"
1
+ # frozen_string_literal: true
6
2
 
7
3
  require "acumatica/client"
4
+ require "acumatica/errors"
5
+
6
+ require "acumatica/resource"
7
+ require "acumatica/customer"
8
+ require "acumatica/sales_order"
8
9
  require "acumatica/stock_item"
10
+
9
11
  require "acumatica/version"
@@ -1,16 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "faraday"
5
+ require "faraday_middleware"
6
+ require "faraday-cookie_jar"
7
+ require "singleton"
8
+
1
9
  module Acumatica
2
10
  class Client
3
11
  include Singleton
4
12
 
5
- API_VERSION = "6.00.001".freeze
13
+ API_VERSION = "6.00.001"
6
14
 
7
- attr_accessor :url, :name, :password, :token
15
+ attr_accessor :url, :name, :password, :token, :debug
8
16
 
9
17
  def self.configure
10
18
  yield(instance)
11
19
  instance
12
20
  end
13
21
 
22
+ def base_url
23
+ @base_url ||= URI.join(url, "entity/Default/#{API_VERSION}/")
24
+ end
25
+
14
26
  def connection
15
27
  @connection ||= Faraday.new do |conn|
16
28
  conn.request :json
@@ -20,12 +32,21 @@ module Acumatica
20
32
  else
21
33
  conn.use :cookie_jar
22
34
  end
35
+ conn.use Acumatica::ErrorHandler
23
36
 
24
37
  conn.response :json
38
+ conn.response :logger, nil, bodies: true if debug
25
39
  conn.adapter Faraday.default_adapter
26
40
  end
27
41
  end
28
42
 
43
+ def session
44
+ login
45
+ result = yield
46
+ logout
47
+ result
48
+ end
49
+
29
50
  def login
30
51
  response = connection.post do |req|
31
52
  req.url URI.join(@url, "/entity/auth/login")
@@ -38,6 +59,14 @@ module Acumatica
38
59
  connection.post(URI.join(@url, "/entity/auth/logout")).success?
39
60
  end
40
61
 
62
+ def customers
63
+ Acumatica::Customer
64
+ end
65
+
66
+ def sales_orders
67
+ Acumatica::SalesOrder
68
+ end
69
+
41
70
  def stock_items
42
71
  Acumatica::StockItem
43
72
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Acumatica
4
+ class Customer < Resource
5
+ end
6
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+
5
+ module Acumatica
6
+ class ErrorHandler < Faraday::Middleware
7
+ def initialize(app)
8
+ super app
9
+ @parser = nil
10
+ end
11
+
12
+ def call(request_env)
13
+ @app.call(request_env).on_complete do |env|
14
+ case env[:status]
15
+ when 400
16
+ raise Acumatica::BadRequest, env
17
+ when 401
18
+ raise Acumatica::Unauthorized, env
19
+ when 500
20
+ raise Acumatica::InternalServerError, env
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ class Error < StandardError
27
+ def initialize(env = {})
28
+ super error_message(env)
29
+ end
30
+
31
+ def error_message(env)
32
+ env[:body]["message"]
33
+ end
34
+ end
35
+
36
+ class BadRequest < Error
37
+ def error_message(env)
38
+ super(env) + ": " + env[:body]["modelState"].values.join(",")
39
+ end
40
+ end
41
+
42
+ class Unauthorized < Error
43
+ end
44
+
45
+ class InternalServerError < Error
46
+ def error_message(env)
47
+ env[:body]["exceptionMessage"]
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/string/inflections"
4
+ require "active_support/core_ext/hash/keys"
5
+ require "active_support/core_ext/hash/transform_values"
6
+ require "ostruct"
7
+
8
+ module Acumatica
9
+ class Resource < OpenStruct
10
+ class << self
11
+ def create(body = {}, params = {})
12
+ response = Acumatica::Client.instance.connection.put do |req|
13
+ req.url url
14
+ req.body = format_request_body(body) if body
15
+ req.params = parse_query_params(params) if params
16
+ end
17
+
18
+ new(response.body)
19
+ end
20
+
21
+ def find_all(params = {})
22
+ response = Acumatica::Client.instance.connection.get do |req|
23
+ req.url url
24
+ req.params = parse_query_params(params) if params
25
+ end
26
+
27
+ response.body.map { |attrs| new(attrs) }
28
+ end
29
+
30
+ def url
31
+ URI.join(Acumatica::Client.instance.base_url, to_s.split("::").last)
32
+ end
33
+
34
+ private
35
+
36
+ def deep_transform_values!(object)
37
+ case object
38
+ when Array
39
+ object.map! { |e| deep_transform_values!(e) }
40
+ when Hash
41
+ object.each do |key, value|
42
+ object[key] = deep_transform_values!(value)
43
+ end
44
+ else
45
+ { "value" => object }
46
+ end
47
+ end
48
+
49
+ def format_request_body(body_hash)
50
+ body = body_hash.deep_transform_keys { |key| key.to_s.camelize.gsub("Id", "ID") }
51
+ deep_transform_values!(body)
52
+ end
53
+
54
+ def parse_query_params(params)
55
+ query_params = {}
56
+
57
+ query_params['$select'] = params[:select] if params[:select]
58
+ query_params['$filter'] = params[:filter] if params[:filter]
59
+ query_params['$expand'] = params[:expand] if params[:expand]
60
+ query_params['$skip'] = params[:offset] if params[:offset]
61
+ query_params['$top'] = params[:limit] if params[:limit]
62
+ query_params
63
+ end
64
+ end
65
+
66
+ def initialize(params = {})
67
+ super(format_params(params))
68
+ format_attributes!
69
+ end
70
+
71
+ private
72
+
73
+ def format_params(params)
74
+ new_params = params.transform_keys { |k| methodify(k) }
75
+ new_params.transform_values! { |v| v.is_a?(Hash) && v.keys == ["value"] ? v.values.first : v }
76
+ end
77
+
78
+ def format_attributes!
79
+ self.attributes ||= []
80
+ attributes.each { |a| self[methodify(a['AttributeID']['value'])] = a['Value']['value'] }
81
+ end
82
+
83
+ def methodify(string)
84
+ string.underscore.parameterize(methodify_separator)
85
+ end
86
+
87
+ def methodify_separator
88
+ @methodify_separator ||=
89
+ if Gem.loaded_specs["activesupport"].version < Gem::Version.create("5.0.0")
90
+ '_'
91
+ else
92
+ { separator: '_' }
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Acumatica
4
+ class SalesOrder < Resource
5
+ end
6
+ end
@@ -1,55 +1,6 @@
1
- module Acumatica
2
- class StockItem < OpenStruct
3
- def self.create(params = {})
4
- response = Acumatica::Client.instance.connection.put do |req|
5
- req.url url
6
- req.body = params
7
- end
8
-
9
- self.new(response.body)
10
- end
11
-
12
- def self.find_all(select: nil, filter: nil, expand: nil, offset: nil, limit: nil)
13
- params = {}
14
-
15
- params['$select'] = select if select
16
- params['$filter'] = filter if filter
17
- params['$expand'] = expand if expand
18
- params['$skip'] = offset if offset
19
- params['$top'] = limit if limit
20
-
21
- response = Acumatica::Client.instance.connection.get do |req|
22
- req.url url
23
- req.params = params
24
- end
25
-
26
- response.body.map { |attrs| self.new(attrs) }
27
- end
1
+ # frozen_string_literal: true
28
2
 
29
- def self.url
30
- URI.join(
31
- Acumatica::Client.instance.url,
32
- "/entity/Default/#{Acumatica::Client::API_VERSION}/StockItem"
33
- )
34
- end
35
-
36
- def initialize(params = {})
37
- new_params = {}
38
- params.each do |k,v|
39
- v = v.values.first if v.is_a?(Hash) && v.keys == ["value"]
40
- new_params[methodify(k)] = v
41
- end
42
-
43
- super(new_params)
44
-
45
- self.attributes ||= []
46
- attributes.each { |a| self[methodify(a['AttributeID']['value'])] = a['Value']['value'] }
47
- end
48
-
49
- private
50
-
51
- def methodify(word)
52
- word.gsub(/([a-z])([A-Z])|\s/,'\1_\2').downcase
53
- end
3
+ module Acumatica
4
+ class StockItem < Resource
54
5
  end
55
6
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Acumatica
2
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acumatica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Moody
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-19 00:00:00.000000000 Z
11
+ date: 2018-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.7.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.55.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.55.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: vcr
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +151,7 @@ dependencies:
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
- name: faraday
154
+ name: activesupport
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
157
  - - ">="
@@ -137,7 +165,7 @@ dependencies:
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
- name: faraday_middleware
168
+ name: faraday
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
171
  - - ">="
@@ -164,6 +192,20 @@ dependencies:
164
192
  - - ">="
165
193
  - !ruby/object:Gem::Version
166
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: faraday_middleware
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
167
209
  - !ruby/object:Gem::Dependency
168
210
  name: json
169
211
  requirement: !ruby/object:Gem::Requirement
@@ -187,6 +229,8 @@ extra_rdoc_files: []
187
229
  files:
188
230
  - ".gitignore"
189
231
  - ".rspec"
232
+ - ".rubocop.yml"
233
+ - ".rubocop_todo.yml"
190
234
  - ".travis.yml"
191
235
  - CODE_OF_CONDUCT.md
192
236
  - Gemfile
@@ -202,6 +246,10 @@ files:
202
246
  - bin/setup
203
247
  - lib/acumatica.rb
204
248
  - lib/acumatica/client.rb
249
+ - lib/acumatica/customer.rb
250
+ - lib/acumatica/errors.rb
251
+ - lib/acumatica/resource.rb
252
+ - lib/acumatica/sales_order.rb
205
253
  - lib/acumatica/stock_item.rb
206
254
  - lib/acumatica/version.rb
207
255
  homepage: https://github.com/jetbuilt/acumatica