lightspeed_pos 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +21 -21
  3. data/.rubocop_todo.yml +2 -16
  4. data/.travis.yml +2 -2
  5. data/Gemfile +2 -0
  6. data/Rakefile +2 -0
  7. data/bin/console +1 -0
  8. data/lib/lightspeed/account.rb +2 -0
  9. data/lib/lightspeed/accounts.rb +2 -0
  10. data/lib/lightspeed/categories.rb +2 -0
  11. data/lib/lightspeed/category.rb +2 -0
  12. data/lib/lightspeed/client.rb +6 -4
  13. data/lib/lightspeed/collection.rb +2 -0
  14. data/lib/lightspeed/customer.rb +2 -0
  15. data/lib/lightspeed/customers.rb +2 -0
  16. data/lib/lightspeed/employee.rb +2 -0
  17. data/lib/lightspeed/employees.rb +2 -0
  18. data/lib/lightspeed/error.rb +2 -0
  19. data/lib/lightspeed/image.rb +2 -0
  20. data/lib/lightspeed/images.rb +2 -0
  21. data/lib/lightspeed/inventories.rb +2 -0
  22. data/lib/lightspeed/inventory.rb +2 -0
  23. data/lib/lightspeed/item.rb +1 -0
  24. data/lib/lightspeed/item_attribute_set.rb +2 -0
  25. data/lib/lightspeed/item_attribute_sets.rb +2 -0
  26. data/lib/lightspeed/item_matrices.rb +2 -0
  27. data/lib/lightspeed/item_matrix.rb +2 -0
  28. data/lib/lightspeed/items.rb +2 -0
  29. data/lib/lightspeed/order.rb +2 -0
  30. data/lib/lightspeed/orders.rb +2 -0
  31. data/lib/lightspeed/price_level.rb +2 -0
  32. data/lib/lightspeed/price_levels.rb +2 -0
  33. data/lib/lightspeed/prices.rb +3 -1
  34. data/lib/lightspeed/request.rb +2 -0
  35. data/lib/lightspeed/request_throttler.rb +2 -0
  36. data/lib/lightspeed/resource.rb +4 -1
  37. data/lib/lightspeed/sale.rb +2 -0
  38. data/lib/lightspeed/sale_line.rb +2 -0
  39. data/lib/lightspeed/sale_lines.rb +2 -0
  40. data/lib/lightspeed/sales.rb +2 -0
  41. data/lib/lightspeed/shop.rb +2 -0
  42. data/lib/lightspeed/shops.rb +2 -0
  43. data/lib/lightspeed/special_order.rb +2 -0
  44. data/lib/lightspeed/special_orders.rb +2 -0
  45. data/lib/lightspeed/vendor.rb +2 -0
  46. data/lib/lightspeed/vendors.rb +2 -0
  47. data/lib/lightspeed/version.rb +3 -1
  48. data/lib/lightspeed_pos.rb +2 -0
  49. data/lightspeed_pos.gemspec +1 -0
  50. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b42db3649e13304941c1fb7770b350bccb22d5751c1f8277c290df0134ea468
4
- data.tar.gz: b2f9b9005019a428f673e7d6999fbc3f4900f2923b13342c9050d0deb88dbc51
3
+ metadata.gz: 1e2ccc9d7b837af97952f9a141a039cd51a33738afd4a73b84c6fc5fcdea3785
4
+ data.tar.gz: 6d83e4ae0b235fce32b917ba87991551323d268ade82e3141ba322160cf3a463
5
5
  SHA512:
6
- metadata.gz: 34f6532de1edfe8417970b7b255557b7882d2bc4df373bdf69631f29bed3b941f7db5eb4a38a1a074bebc539b5e3c6e192d47d3d6db8a5294b6aa4d156fc1c10
7
- data.tar.gz: 78455dc05e80e7246e13dd858bcb30d40956a75967ed9e8bb516e24b122be63287b8678d508d29c25483615be7ad7488395cb7a2f1a3c93631c6f819dddef06f
6
+ metadata.gz: 85166fc067120f76b26cfb2234bfdda912118a301e547cd81de0d6f18c04dbabec4ee7c69388bb80761c3be0225426b341e08124b2c6330cc6153d0934f18ef1
7
+ data.tar.gz: fd605b19b54e1bd31486b1a144ababadef69834666cc6cfa50c28b91bf92290ca6df738f67bc39d2bf80d81978fce114c0c2a80d1e2c53252dc1d75392e1842c
@@ -1,70 +1,70 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- AlignHash:
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ Layout/HashAlignment:
4
7
  EnforcedLastArgumentHashStyle: always_ignore
5
8
 
6
- AlignParameters:
9
+ Layout/ParameterAlignment:
7
10
  Enabled: false
8
11
 
9
- LineLength:
12
+ Layout/LineLength:
10
13
  Max: 180
11
14
 
12
- ClassLength:
15
+ Metrics/ClassLength:
13
16
  Enabled: true
14
17
  Severity: refactor
15
18
  Max: 300
16
19
 
17
- MethodLength:
20
+ Metrics/MethodLength:
18
21
  Enabled: true
19
22
  Max: 30
20
23
  Severity: refactor
21
24
 
22
- CyclomaticComplexity:
25
+ Metrics/CyclomaticComplexity:
23
26
  Max: 10
24
27
  Severity: refactor
25
28
 
26
- EndAlignment:
29
+ Layout/EndAlignment:
27
30
  Enabled: false
28
31
 
29
- StringLiterals:
32
+ Style/StringLiterals:
30
33
  Enabled: false
31
34
 
32
- Documentation:
35
+ Style/Documentation:
33
36
  Enabled: false
34
37
 
35
- PercentLiteralDelimiters:
38
+ Style/PercentLiteralDelimiters:
36
39
  PreferredDelimiters:
37
40
  '%w': '{}'
38
41
 
39
- MethodDefParentheses:
42
+ Style/MethodDefParentheses:
40
43
  Enabled: false
41
44
 
42
- PredicateName:
43
- NamePrefixBlacklist:
45
+ Naming/PredicateName:
46
+ ForbiddenPrefixes:
44
47
  - is_
45
48
  - have_
46
49
 
47
- IndentFirstHashElement:
50
+ Layout/FirstHashElementIndentation:
48
51
  EnforcedStyle: consistent
49
52
 
50
53
  # breaks using if blocks with assignments
51
- IndentationWidth:
54
+ Layout/IndentationWidth:
52
55
  Enabled: false
53
56
 
54
57
  Layout/CaseIndentation:
55
58
  EnforcedStyle: end
56
59
 
57
- FormatString:
58
- Enabled: false
59
-
60
- ActionFilter:
60
+ Style/FormatString:
61
61
  Enabled: false
62
62
 
63
63
  # different methods calls that do exactly the same thing are a smell, regardless of semantics
64
- SignalException:
64
+ Style/SignalException:
65
65
  EnforcedStyle: only_raise
66
66
 
67
- DoubleNegation:
67
+ Style/DoubleNegation:
68
68
  Enabled: false
69
69
 
70
70
  Style/TrailingCommaInArrayLiteral:
@@ -68,12 +68,6 @@ Layout/EmptyLinesAroundClassBody:
68
68
  - 'lib/lightspeed/sale_line.rb'
69
69
  - 'lib/lightspeed/vendor.rb'
70
70
 
71
- # Offense count: 1
72
- # Cop supports --auto-correct.
73
- Layout/LeadingBlankLines:
74
- Exclude:
75
- - 'lib/lightspeed/item.rb'
76
-
77
71
  # Offense count: 3
78
72
  # Cop supports --auto-correct.
79
73
  # Configuration parameters: EnforcedStyle, IndentationWidth.
@@ -108,7 +102,7 @@ Layout/SpaceInsideHashLiteralBraces:
108
102
  # Cop supports --auto-correct.
109
103
  # Configuration parameters: EnforcedStyle.
110
104
  # SupportedStyles: final_newline, final_blank_line
111
- Layout/TrailingBlankLines:
105
+ Layout/TrailingEmptyLines:
112
106
  Exclude:
113
107
  - 'lib/lightspeed/customer.rb'
114
108
  - 'lib/lightspeed/customers.rb'
@@ -174,7 +168,7 @@ Metrics/BlockLength:
174
168
  # Offense count: 2
175
169
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
176
170
  # AllowedNames: io, id, to, by, on, in, at, ip, db
177
- Naming/UncommunicativeMethodParamName:
171
+ Naming/MethodParameterName:
178
172
  Exclude:
179
173
  - 'lib/lightspeed/accounts.rb'
180
174
  - 'lib/lightspeed/collection.rb'
@@ -199,14 +193,6 @@ Style/Alias:
199
193
  - 'lib/lightspeed/vendor.rb'
200
194
  - 'lib/lightspeed/vendors.rb'
201
195
 
202
- # Offense count: 1
203
- # Cop supports --auto-correct.
204
- # Configuration parameters: EnforcedStyle.
205
- # SupportedStyles: braces, no_braces, context_dependent
206
- Style/BracesAroundHashParameters:
207
- Exclude:
208
- - 'spec/lightspeed/sales_spec.rb'
209
-
210
196
  # Offense count: 1
211
197
  # Cop supports --auto-correct.
212
198
  # Configuration parameters: Keywords.
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3
4
- - 2.4
5
3
  - 2.5
4
+ - 2.6
5
+ - 2.7
6
6
  script:
7
7
  - 'bundle exec rubocop'
8
8
  - 'bundle exec rspec spec'
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in lightspeed-pos.gemspec
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'dotenv'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'uri'
2
4
  require_relative 'categories'
3
5
  require_relative 'employees'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
  require_relative 'account'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'category'
2
4
  require_relative 'collection'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/array/wrap'
2
4
 
3
5
  require_relative 'accounts'
@@ -21,19 +23,19 @@ module Lightspeed
21
23
  end
22
24
 
23
25
  def get(**args)
24
- perform_request(args.merge(method: :get))
26
+ perform_request(**args, method: :get)
25
27
  end
26
28
 
27
29
  def post(**args)
28
- perform_request(args.merge(method: :post))
30
+ perform_request(**args, method: :post)
29
31
  end
30
32
 
31
33
  def put(**args)
32
- perform_request(args.merge(method: :put))
34
+ perform_request(**args, method: :put)
33
35
  end
34
36
 
35
37
  def delete(**args)
36
- perform_request(args.merge(method: :delete))
38
+ perform_request(**args, method: :delete)
37
39
  end
38
40
 
39
41
  def oauth_token
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/string'
2
4
  require 'active_support/core_ext/array/wrap'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'customer'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'employee'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lightspeed
2
4
  class Error < Exception
3
5
  class BadRequest < Lightspeed::Error; end # 400
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  require_relative 'item'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'image'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'inventory'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  require_relative 'item'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  require_relative 'resource'
3
4
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'item_attribute_set'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'item_matrix'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  require_relative 'item_attribute_set'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'item'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'order'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'price_level'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/string'
2
4
  require 'bigdecimal'
3
5
 
@@ -8,7 +10,7 @@ module Lightspeed
8
10
  end
9
11
 
10
12
  def prices
11
- @prices ||= @attributes["ItemPrice"].map { |v| [v["useType"].parameterize.underscore.to_sym, BigDecimal.new(v["amount"])] }.to_h
13
+ @prices ||= @attributes["ItemPrice"].map { |v| [v["useType"].parameterize.underscore.to_sym, BigDecimal(v["amount"])] }.to_h
12
14
  end
13
15
 
14
16
  def as_json
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pp'
2
4
  require 'net/http'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lightspeed
2
4
  class RequestThrottler
3
5
  attr_accessor :bucket_level, :bucket_max, :units_per_second
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bigdecimal'
2
4
  require 'active_support/core_ext/string'
3
5
  require 'active_support/core_ext/hash/slice'
@@ -32,6 +34,7 @@ module Lightspeed
32
34
  def self.fields(fields = {})
33
35
  @fields ||= []
34
36
  attr_writer(*fields.keys)
37
+
35
38
  fields.each do |name, klass|
36
39
  @fields << define_method(name) do
37
40
  get_transformed_value(name, klass)
@@ -49,7 +52,7 @@ module Lightspeed
49
52
  when :id then value.to_i
50
53
  when :datetime then DateTime.parse(value)
51
54
  when :boolean then value == 'true'
52
- when :decimal then BigDecimal.new(value)
55
+ when :decimal then BigDecimal(value)
53
56
  when :hash then Hash.new(value)
54
57
  else
55
58
  raise ArgumentError, "Could not transform value #{value} to a #{kind}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  require_relative 'sale_lines'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
  require_relative 'item'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
  require_relative 'sale_line'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'sale'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'shop'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'special_order'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Lightspeed
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'collection'
2
4
 
3
5
  require_relative 'vendor'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lightspeed
2
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yajl'
2
4
 
3
5
  module Lightspeed
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'lightspeed/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightspeed_pos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-05 00:00:00.000000000 Z
11
+ date: 2020-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -232,8 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  - !ruby/object:Gem::Version
233
233
  version: '0'
234
234
  requirements: []
235
- rubyforge_project:
236
- rubygems_version: 2.7.6
235
+ rubygems_version: 3.1.2
237
236
  signing_key:
238
237
  specification_version: 4
239
238
  summary: A gem for interacting with Lightspeed's Point of Sale system