lightspeed_pos 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +24 -21
- data/.rubocop_todo.yml +2 -16
- data/.travis.yml +3 -2
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/lib/lightspeed/account.rb +2 -0
- data/lib/lightspeed/accounts.rb +3 -1
- data/lib/lightspeed/categories.rb +2 -0
- data/lib/lightspeed/category.rb +2 -0
- data/lib/lightspeed/client.rb +6 -4
- data/lib/lightspeed/collection.rb +3 -1
- data/lib/lightspeed/customer.rb +2 -0
- data/lib/lightspeed/customers.rb +2 -0
- data/lib/lightspeed/employee.rb +2 -0
- data/lib/lightspeed/employees.rb +2 -0
- data/lib/lightspeed/error.rb +7 -0
- data/lib/lightspeed/image.rb +2 -0
- data/lib/lightspeed/images.rb +2 -0
- data/lib/lightspeed/inventories.rb +2 -0
- data/lib/lightspeed/inventory.rb +2 -0
- data/lib/lightspeed/item.rb +1 -0
- data/lib/lightspeed/item_attribute_set.rb +2 -0
- data/lib/lightspeed/item_attribute_sets.rb +2 -0
- data/lib/lightspeed/item_matrices.rb +2 -0
- data/lib/lightspeed/item_matrix.rb +2 -0
- data/lib/lightspeed/items.rb +2 -0
- data/lib/lightspeed/order.rb +2 -0
- data/lib/lightspeed/orders.rb +2 -0
- data/lib/lightspeed/price_level.rb +2 -0
- data/lib/lightspeed/price_levels.rb +2 -0
- data/lib/lightspeed/prices.rb +3 -1
- data/lib/lightspeed/request.rb +3 -1
- data/lib/lightspeed/request_throttler.rb +2 -0
- data/lib/lightspeed/resource.rb +6 -4
- data/lib/lightspeed/sale.rb +2 -0
- data/lib/lightspeed/sale_line.rb +2 -0
- data/lib/lightspeed/sale_lines.rb +2 -0
- data/lib/lightspeed/sales.rb +2 -0
- data/lib/lightspeed/shop.rb +2 -0
- data/lib/lightspeed/shops.rb +2 -0
- data/lib/lightspeed/special_order.rb +2 -0
- data/lib/lightspeed/special_orders.rb +2 -0
- data/lib/lightspeed/vendor.rb +2 -0
- data/lib/lightspeed/vendors.rb +2 -0
- data/lib/lightspeed/version.rb +3 -1
- data/lib/lightspeed_pos.rb +2 -0
- data/lightspeed_pos.gemspec +3 -0
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 698710d57a5ef3c30c022c2f050b9df04976227b2482a3075c851b27db3642fe
|
4
|
+
data.tar.gz: 6abdc460a2cd345883c2cb853c9c6c16051273606914d7ba5fcaa72089402dae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03f3b9db98a4145a9751b2990beabccf96d79a78fece26a40a3163ffe0d8604ea41ad0316b52ce9a3e27f77fea1e6cb0ce708438bc37c22cacef0a0401ef9245
|
7
|
+
data.tar.gz: 3c8f3710b4f8e76bda81e5e02265115c0252c38b8c177ff707c9dab53026da1d8598504d77ae9d31c3a17a0cfa2796d5cd293355b25b7c8aeca4e44762e26830
|
data/.rubocop.yml
CHANGED
@@ -1,70 +1,73 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
-
|
3
|
+
AllCops:
|
4
|
+
NewCops: enable
|
5
|
+
SuggestExtensions:
|
6
|
+
rubocop-rake: false
|
7
|
+
rubocop-rspec: false
|
8
|
+
|
9
|
+
Layout/HashAlignment:
|
4
10
|
EnforcedLastArgumentHashStyle: always_ignore
|
5
11
|
|
6
|
-
|
12
|
+
Layout/ParameterAlignment:
|
7
13
|
Enabled: false
|
8
14
|
|
9
|
-
LineLength:
|
15
|
+
Layout/LineLength:
|
10
16
|
Max: 180
|
11
17
|
|
12
|
-
ClassLength:
|
18
|
+
Metrics/ClassLength:
|
13
19
|
Enabled: true
|
14
20
|
Severity: refactor
|
15
21
|
Max: 300
|
16
22
|
|
17
|
-
MethodLength:
|
23
|
+
Metrics/MethodLength:
|
18
24
|
Enabled: true
|
19
25
|
Max: 30
|
20
26
|
Severity: refactor
|
21
27
|
|
22
|
-
CyclomaticComplexity:
|
28
|
+
Metrics/CyclomaticComplexity:
|
23
29
|
Max: 10
|
24
30
|
Severity: refactor
|
25
31
|
|
26
|
-
EndAlignment:
|
32
|
+
Layout/EndAlignment:
|
27
33
|
Enabled: false
|
28
34
|
|
29
|
-
StringLiterals:
|
35
|
+
Style/StringLiterals:
|
30
36
|
Enabled: false
|
31
37
|
|
32
|
-
Documentation:
|
38
|
+
Style/Documentation:
|
33
39
|
Enabled: false
|
34
40
|
|
35
|
-
PercentLiteralDelimiters:
|
41
|
+
Style/PercentLiteralDelimiters:
|
36
42
|
PreferredDelimiters:
|
37
43
|
'%w': '{}'
|
38
44
|
|
39
|
-
MethodDefParentheses:
|
45
|
+
Style/MethodDefParentheses:
|
40
46
|
Enabled: false
|
41
47
|
|
42
|
-
PredicateName:
|
43
|
-
|
48
|
+
Naming/PredicateName:
|
49
|
+
ForbiddenPrefixes:
|
44
50
|
- is_
|
45
51
|
- have_
|
46
52
|
|
47
|
-
|
53
|
+
Layout/FirstHashElementIndentation:
|
48
54
|
EnforcedStyle: consistent
|
49
55
|
|
50
56
|
# breaks using if blocks with assignments
|
51
|
-
IndentationWidth:
|
57
|
+
Layout/IndentationWidth:
|
52
58
|
Enabled: false
|
53
59
|
|
54
60
|
Layout/CaseIndentation:
|
55
61
|
EnforcedStyle: end
|
56
62
|
|
57
|
-
FormatString:
|
58
|
-
Enabled: false
|
59
|
-
|
60
|
-
ActionFilter:
|
63
|
+
Style/FormatString:
|
61
64
|
Enabled: false
|
62
65
|
|
63
66
|
# different methods calls that do exactly the same thing are a smell, regardless of semantics
|
64
|
-
SignalException:
|
67
|
+
Style/SignalException:
|
65
68
|
EnforcedStyle: only_raise
|
66
69
|
|
67
|
-
DoubleNegation:
|
70
|
+
Style/DoubleNegation:
|
68
71
|
Enabled: false
|
69
72
|
|
70
73
|
Style/TrailingCommaInArrayLiteral:
|
data/.rubocop_todo.yml
CHANGED
@@ -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/
|
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/
|
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.
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/lib/lightspeed/account.rb
CHANGED
data/lib/lightspeed/accounts.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'collection'
|
2
4
|
require_relative 'account'
|
3
5
|
|
@@ -11,7 +13,7 @@ module Lightspeed
|
|
11
13
|
first_loaded || first
|
12
14
|
end
|
13
15
|
|
14
|
-
def page(n,
|
16
|
+
def page(n, **args)
|
15
17
|
# turns out lightspeed doesn't respect pagination for accounts.
|
16
18
|
# so page(1) is identical to page(0).
|
17
19
|
# they should be different, thus.
|
data/lib/lightspeed/category.rb
CHANGED
data/lib/lightspeed/client.rb
CHANGED
@@ -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
|
26
|
+
perform_request(**args, method: :get)
|
25
27
|
end
|
26
28
|
|
27
29
|
def post(**args)
|
28
|
-
perform_request(args
|
30
|
+
perform_request(**args, method: :post)
|
29
31
|
end
|
30
32
|
|
31
33
|
def put(**args)
|
32
|
-
perform_request(args
|
34
|
+
perform_request(**args, method: :put)
|
33
35
|
end
|
34
36
|
|
35
37
|
def delete(**args)
|
36
|
-
perform_request(args
|
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
|
|
@@ -174,7 +176,7 @@ module Lightspeed
|
|
174
176
|
params = { load_relations: load_relations_default }
|
175
177
|
.merge(context_params)
|
176
178
|
.merge(params)
|
177
|
-
.
|
179
|
+
.compact
|
178
180
|
client.get(
|
179
181
|
path: collection_path,
|
180
182
|
params: params
|
data/lib/lightspeed/customer.rb
CHANGED
data/lib/lightspeed/customers.rb
CHANGED
data/lib/lightspeed/employee.rb
CHANGED
data/lib/lightspeed/employees.rb
CHANGED
data/lib/lightspeed/error.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Lightspeed
|
2
4
|
class Error < Exception
|
3
5
|
class BadRequest < Lightspeed::Error; end # 400
|
6
|
+
|
4
7
|
class Unauthorized < Lightspeed::Error; end # 401
|
8
|
+
|
5
9
|
class NotAuthorized < Lightspeed::Error; end # 403
|
10
|
+
|
6
11
|
class NotFound < Lightspeed::Error; end # 404
|
12
|
+
|
7
13
|
class InternalServerError < Lightspeed::Error; end # 500
|
14
|
+
|
8
15
|
class Throttled < Lightspeed::Error; end # 503
|
9
16
|
end
|
10
17
|
end
|
data/lib/lightspeed/image.rb
CHANGED
data/lib/lightspeed/images.rb
CHANGED
data/lib/lightspeed/inventory.rb
CHANGED
data/lib/lightspeed/item.rb
CHANGED
data/lib/lightspeed/items.rb
CHANGED
data/lib/lightspeed/order.rb
CHANGED
data/lib/lightspeed/orders.rb
CHANGED
data/lib/lightspeed/prices.rb
CHANGED
@@ -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
|
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
|
data/lib/lightspeed/request.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pp'
|
2
4
|
require 'net/http'
|
3
5
|
|
@@ -106,7 +108,7 @@ module Lightspeed
|
|
106
108
|
|
107
109
|
def uri
|
108
110
|
uri = self.class.base_path + @path
|
109
|
-
uri += "
|
111
|
+
uri += "?#{URI.encode_www_form(@params)}" if @params && @method == :get
|
110
112
|
uri
|
111
113
|
end
|
112
114
|
|
data/lib/lightspeed/resource.rb
CHANGED
@@ -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'
|
@@ -6,7 +8,7 @@ require_relative 'collection'
|
|
6
8
|
|
7
9
|
module Lightspeed
|
8
10
|
class ID < Integer; end
|
9
|
-
class Link; end
|
11
|
+
class Link; end # rubocop:disable Lint/EmptyClass
|
10
12
|
class Resource
|
11
13
|
attr_accessor :id, :attributes, :client, :context, :account
|
12
14
|
|
@@ -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)
|
@@ -45,11 +48,10 @@ module Lightspeed
|
|
45
48
|
if value.is_a?(String)
|
46
49
|
case kind
|
47
50
|
when :string then value
|
48
|
-
when :integer then value.to_i
|
49
|
-
when :id then value.to_i
|
51
|
+
when :id, :integer then value.to_i
|
50
52
|
when :datetime then DateTime.parse(value)
|
51
53
|
when :boolean then value == 'true'
|
52
|
-
when :decimal then BigDecimal
|
54
|
+
when :decimal then BigDecimal(value)
|
53
55
|
when :hash then Hash.new(value)
|
54
56
|
else
|
55
57
|
raise ArgumentError, "Could not transform value #{value} to a #{kind}"
|
data/lib/lightspeed/sale.rb
CHANGED
data/lib/lightspeed/sale_line.rb
CHANGED
data/lib/lightspeed/sales.rb
CHANGED
data/lib/lightspeed/shop.rb
CHANGED
data/lib/lightspeed/shops.rb
CHANGED
data/lib/lightspeed/vendor.rb
CHANGED
data/lib/lightspeed/vendors.rb
CHANGED
data/lib/lightspeed/version.rb
CHANGED
data/lib/lightspeed_pos.rb
CHANGED
data/lightspeed_pos.gemspec
CHANGED
@@ -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'
|
@@ -19,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
19
20
|
spec.require_paths = ["lib"]
|
20
21
|
spec.license = "MIT"
|
21
22
|
|
23
|
+
spec.required_ruby_version = '>= 2.5'
|
24
|
+
|
22
25
|
spec.add_dependency "activesupport"
|
23
26
|
spec.add_dependency "yajl-ruby"
|
24
27
|
|
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
|
+
version: 0.6.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:
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -225,15 +225,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
225
|
requirements:
|
226
226
|
- - ">="
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version: '
|
228
|
+
version: '2.5'
|
229
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
230
|
requirements:
|
231
231
|
- - ">="
|
232
232
|
- !ruby/object:Gem::Version
|
233
233
|
version: '0'
|
234
234
|
requirements: []
|
235
|
-
|
236
|
-
rubygems_version: 2.7.6
|
235
|
+
rubygems_version: 3.2.3
|
237
236
|
signing_key:
|
238
237
|
specification_version: 4
|
239
238
|
summary: A gem for interacting with Lightspeed's Point of Sale system
|