oreilly_api 1.0.0 → 1.0.2

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
  SHA256:
3
- metadata.gz: '09364ca17a234cc27c6829b0317dadc2c81cec676ab74986fdf6f13198f7cf0f'
4
- data.tar.gz: e2fe98659b11d63da56f5757bf92eddf0b54941eb5b1a6f01a95c790089d9632
3
+ metadata.gz: 7eb1943971c134c0817a0a6d0cebf7a960e8d450376a11be451910bb3c28bb28
4
+ data.tar.gz: 1cd243dceb0ceab65ac9e6f16cd6e8e4da0002b7849911f3c14280d2db0b2492
5
5
  SHA512:
6
- metadata.gz: 65f0837929cf1333b20af74f1af02d7da2faacca75dcfa7cfda7faa6dbb148de678db5839c3ed0f136a77b6622c4c2925613fd246f59191b1626a8e5ee97edad
7
- data.tar.gz: 82c5dcd33f177b7c1ada7c66dbdfadd913eff3a80f5fceb392b5b5ab793c64081b20239927caabdfa4adeabef52da8923c1ecee4611cf6f2b9269c842bd49994
6
+ metadata.gz: 1cf84a0a7f5824f5043d6f0f3b292cfd46d5f9786e498d033510d0ca3c2c12b19f76d3c1821c8d42c79746e565f26b99e84f06b382d7c1ed22540830ea0aa20d
7
+ data.tar.gz: 8105641fa782d036e1ebb565a6418147a8ab11f5a02c3367988d5e5705df67b77aca715dfd7d8e0c85be49b44646c085e606864ab402607e4af4e003ddaf0a6e
data/.rspec_status CHANGED
@@ -1,8 +1,8 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------- | ------- | --------------- |
3
- ./spec/oreilly_api_spec.rb[1:1] | passed | 0.00057 seconds |
4
- ./spec/oreilly_api_spec.rb[1:2] | passed | 0.02444 seconds |
5
- ./spec/oreilly_api_spec.rb[1:3] | passed | 0.00974 seconds |
6
- ./spec/oreilly_api_spec.rb[1:4] | pending | 0.00001 seconds |
7
- ./spec/oreilly_api_spec.rb[1:5] | passed | 0.01098 seconds |
8
- ./spec/oreilly_api_spec.rb[1:6] | passed | 0.00897 seconds |
3
+ ./spec/oreilly_api_spec.rb[1:1] | passed | 0.00312 seconds |
4
+ ./spec/oreilly_api_spec.rb[1:2] | passed | 0.03616 seconds |
5
+ ./spec/oreilly_api_spec.rb[1:3] | passed | 0.01192 seconds |
6
+ ./spec/oreilly_api_spec.rb[1:4] | pending | 0.00002 seconds |
7
+ ./spec/oreilly_api_spec.rb[1:5] | passed | 0.01359 seconds |
8
+ ./spec/oreilly_api_spec.rb[1:6] | passed | 0.01565 seconds |
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oreilly_api (1.0.0)
4
+ oreilly_api (1.0.2)
5
5
  byebug
6
6
  redis
7
7
  redis_utility
@@ -17,70 +17,71 @@ GEM
17
17
  byebug (11.1.3)
18
18
  crack (0.4.5)
19
19
  rexml
20
- diff-lcs (1.5.0)
20
+ diff-lcs (1.4.4)
21
21
  domain_name (0.5.20190701)
22
22
  unf (>= 0.0.5, < 1.0.0)
23
23
  hashdiff (1.0.1)
24
24
  http-accept (1.7.0)
25
- http-cookie (1.0.5)
25
+ http-cookie (1.0.4)
26
26
  domain_name (~> 0.5)
27
27
  mime-types (3.4.1)
28
28
  mime-types-data (~> 3.2015)
29
- mime-types-data (3.2022.0105)
29
+ mime-types-data (3.2021.1115)
30
30
  multi_json (1.15.0)
31
31
  netrc (0.11.0)
32
- parallel (1.22.1)
33
- parser (3.1.2.0)
32
+ parallel (1.21.0)
33
+ parser (3.0.2.0)
34
34
  ast (~> 2.4.1)
35
- public_suffix (4.0.7)
36
- rainbow (3.1.1)
35
+ public_suffix (4.0.6)
36
+ rainbow (3.0.0)
37
37
  rake (13.0.6)
38
- redis (4.6.0)
38
+ redis (4.5.1)
39
39
  redis_utility (1.0.0)
40
- regexp_parser (2.5.0)
40
+ regexp_parser (2.1.1)
41
41
  rest-client (2.1.0)
42
42
  http-accept (>= 1.7.0, < 2.0)
43
43
  http-cookie (>= 1.0.2, < 2.0)
44
44
  mime-types (>= 1.16, < 4.0)
45
45
  netrc (~> 0.8)
46
46
  rexml (3.2.5)
47
- rspec (3.11.0)
48
- rspec-core (~> 3.11.0)
49
- rspec-expectations (~> 3.11.0)
50
- rspec-mocks (~> 3.11.0)
51
- rspec-core (3.11.0)
52
- rspec-support (~> 3.11.0)
53
- rspec-expectations (3.11.0)
47
+ rspec (3.10.0)
48
+ rspec-core (~> 3.10.0)
49
+ rspec-expectations (~> 3.10.0)
50
+ rspec-mocks (~> 3.10.0)
51
+ rspec-core (3.10.1)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-expectations (3.10.1)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.11.0)
56
- rspec-mocks (3.11.1)
55
+ rspec-support (~> 3.10.0)
56
+ rspec-mocks (3.10.2)
57
57
  diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.11.0)
59
- rspec-support (3.11.0)
60
- rubocop (1.30.0)
58
+ rspec-support (~> 3.10.0)
59
+ rspec-support (3.10.2)
60
+ rubocop (1.21.0)
61
61
  parallel (~> 1.10)
62
- parser (>= 3.1.0.0)
62
+ parser (>= 3.0.0.0)
63
63
  rainbow (>= 2.2.2, < 4.0)
64
64
  regexp_parser (>= 1.8, < 3.0)
65
- rexml (>= 3.2.5, < 4.0)
66
- rubocop-ast (>= 1.18.0, < 2.0)
65
+ rexml
66
+ rubocop-ast (>= 1.9.1, < 2.0)
67
67
  ruby-progressbar (~> 1.7)
68
68
  unicode-display_width (>= 1.4.0, < 3.0)
69
- rubocop-ast (1.18.0)
70
- parser (>= 3.1.1.0)
69
+ rubocop-ast (1.11.0)
70
+ parser (>= 3.0.1.1)
71
71
  ruby-progressbar (1.11.0)
72
72
  unf (0.1.4)
73
73
  unf_ext
74
- unf_ext (0.0.8.2)
74
+ unf_ext (0.0.8)
75
75
  unicode-display_width (2.1.0)
76
76
  webmock (3.14.0)
77
77
  addressable (>= 2.8.0)
78
78
  crack (>= 0.3.2)
79
79
  hashdiff (>= 0.4.0, < 2.0.0)
80
- yajl-ruby (1.4.3)
80
+ yajl-ruby (1.4.1)
81
81
 
82
82
  PLATFORMS
83
- x86_64-darwin-19
83
+ x86_64-darwin-20
84
+ x86_64-linux
84
85
 
85
86
  DEPENDENCIES
86
87
  bundler (~> 2.2.8)
@@ -92,4 +93,4 @@ DEPENDENCIES
92
93
  webmock
93
94
 
94
95
  BUNDLED WITH
95
- 2.2.33
96
+ 2.2.32
data/Rakefile CHANGED
@@ -10,3 +10,7 @@ require 'rubocop/rake_task'
10
10
  RuboCop::RakeTask.new
11
11
 
12
12
  task default: %i[spec rubocop]
13
+
14
+ task :console do
15
+ exec "irb -r oreilly_api -I ./lib"
16
+ end
@@ -1,3 +1,3 @@
1
1
  module OreillyApi
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
data/lib/oreilly_api.rb CHANGED
@@ -8,12 +8,13 @@ require 'redis'
8
8
  require 'redis_utility'
9
9
 
10
10
  # rubocop:disable Metrics/MethodLength
11
+ # rubocop:disable Layout/LineLength
11
12
 
12
13
  # OreillyApi
13
14
  module OreillyApi
14
15
  TOKEN = 'oreilly_api_token'
15
16
  class << self
16
- attr_accessor :domain, :version, :client_id, :client_secret, :identity, :account_number
17
+ attr_accessor :domain, :version, :client_id, :client_secret, :identity, :account_number, :device_id
17
18
 
18
19
  def config
19
20
  yield self
@@ -27,7 +28,7 @@ module OreillyApi
27
28
  "YM#{OreillyApi.account_number}#{DateTime.now.strftime('%Y%m%d%l%S%M')}}"
28
29
  end
29
30
 
30
- def place_order(po_number, vehicles_with_items, stop_order: false)
31
+ def place_order(po_number, customer_location_id, vehicles_with_items, stop_order: false)
31
32
  payload = {
32
33
  'header' => {
33
34
  'identity' => OreillyApi.identity,
@@ -36,6 +37,7 @@ module OreillyApi
36
37
  },
37
38
  'orderHeader' => {
38
39
  'poNumber' => po_number,
40
+ 'customerLocationId': customer_location_id || '',
39
41
  'accountNumber' => OreillyApi.account_number,
40
42
  'comments' => "test"
41
43
  },
@@ -104,7 +106,7 @@ module OreillyApi
104
106
  }.to_json
105
107
 
106
108
  params = "&client_id=#{OreillyApi.client_id}&client_secret=#{OreillyApi.client_secret}"
107
- url = "#{OreillyApi.domain}/oauth-server/oauth/token?grant_type=client_credentials&device_id=test#{params}"
109
+ url = "#{OreillyApi.domain}/oauth-server/oauth/token?grant_type=client_credentials&device_id=#{OreillyApi.device_id}#{params}"
108
110
  res = RestClient.post(url, payload, { 'Content-Type' => 'application/json' })
109
111
  token_info = JSON.parse(res)
110
112
  @token = token_info['access_token']
@@ -121,4 +123,5 @@ module OreillyApi
121
123
  end
122
124
  end
123
125
  # rubocop:enable Metrics/MethodLength
126
+ # rubocop:enable Layout/LineLength
124
127
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oreilly_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - TruptiHosmani
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-03 00:00:00.000000000 Z
11
+ date: 2023-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubygems_version: 3.0.3
202
+ rubygems_version: 3.0.9
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: Gem to integrate O'Reilly Auto Parts Rest API