oreilly_api 1.0.2 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eb1943971c134c0817a0a6d0cebf7a960e8d450376a11be451910bb3c28bb28
4
- data.tar.gz: 1cd243dceb0ceab65ac9e6f16cd6e8e4da0002b7849911f3c14280d2db0b2492
3
+ metadata.gz: c9f5038e7928719e445cdd07449a7d88f1dfe2bf82cdf47db6d51d31dd5ba081
4
+ data.tar.gz: f2a09c91d003feb1774df8b3a6dae3de07d618689f7ba75b5ff76799da9d322f
5
5
  SHA512:
6
- metadata.gz: 1cf84a0a7f5824f5043d6f0f3b292cfd46d5f9786e498d033510d0ca3c2c12b19f76d3c1821c8d42c79746e565f26b99e84f06b382d7c1ed22540830ea0aa20d
7
- data.tar.gz: 8105641fa782d036e1ebb565a6418147a8ab11f5a02c3367988d5e5705df67b77aca715dfd7d8e0c85be49b44646c085e606864ab402607e4af4e003ddaf0a6e
6
+ metadata.gz: '038a777daaddf9708f22a84afa6fa0d830283868ca26ac2ff15df3ccb433b66157a98284f0d5f6b172fa4b81a3482b58a84730d2215ffa9b3d049b58552941d3'
7
+ data.tar.gz: 8fcedc483cbb2e88cd2ce74e8e40f196f977a049294639cddf7c32c9185d304f80a2b48e7bc7c87c81bc2381125d05972938f4501692dc536a6f9428380f64f5
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.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 |
3
+ ./spec/oreilly_api_spec.rb[1:1] | passed | 0.00108 seconds |
4
+ ./spec/oreilly_api_spec.rb[1:2] | passed | 0.0281 seconds |
5
+ ./spec/oreilly_api_spec.rb[1:3] | passed | 0.00814 seconds |
6
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 |
7
+ ./spec/oreilly_api_spec.rb[1:5] | passed | 0.01212 seconds |
8
+ ./spec/oreilly_api_spec.rb[1:6] | passed | 0.01094 seconds |
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oreilly_api (1.0.2)
4
+ oreilly_api (1.0.3)
5
5
  byebug
6
6
  redis
7
7
  redis_utility
data/README.md CHANGED
@@ -31,7 +31,6 @@ OreillyApi.config do |c|
31
31
  c.client_secret = 'client_sercet'
32
32
  c.identity = 'IDENTITY'
33
33
  c.version = 'sms-external-partner/services'
34
- c.account_number = '123456'
35
34
  end
36
35
  ```
37
36
 
@@ -1,3 +1,3 @@
1
1
  module OreillyApi
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/lib/oreilly_api.rb CHANGED
@@ -14,7 +14,7 @@ require 'redis_utility'
14
14
  module OreillyApi
15
15
  TOKEN = 'oreilly_api_token'
16
16
  class << self
17
- attr_accessor :domain, :version, :client_id, :client_secret, :identity, :account_number, :device_id
17
+ attr_accessor :domain, :version, :client_id, :client_secret, :identity, :device_id
18
18
 
19
19
  def config
20
20
  yield self
@@ -24,22 +24,21 @@ module OreillyApi
24
24
  RedisUtility.redis_config = redis_config
25
25
  end
26
26
 
27
- def payload_id
28
- "YM#{OreillyApi.account_number}#{DateTime.now.strftime('%Y%m%d%l%S%M')}}"
27
+ def payload_id(account_number)
28
+ "YM#{account_number}#{DateTime.now.strftime('%Y%m%d%l%S%M')}"
29
29
  end
30
30
 
31
- def place_order(po_number, customer_location_id, vehicles_with_items, stop_order: false)
31
+ def place_order(po_number, account_number, vehicles_with_items, stop_order: false)
32
32
  payload = {
33
33
  'header' => {
34
34
  'identity' => OreillyApi.identity,
35
- 'payloadId' => OreillyApi.payload_id,
35
+ 'payloadId' => OreillyApi.payload_id(account_number),
36
36
  'timestamp' => Time.now.strftime("%Y-%m-%d %H:%M:%S")
37
37
  },
38
38
  'orderHeader' => {
39
39
  'poNumber' => po_number,
40
- 'customerLocationId': customer_location_id || '',
41
- 'accountNumber' => OreillyApi.account_number,
42
- 'comments' => "test"
40
+ 'accountNumber' => account_number,
41
+ 'comments' => "comments"
43
42
  },
44
43
  'vehicles' => vehicles_with_items
45
44
  }.to_json
@@ -50,12 +49,12 @@ module OreillyApi
50
49
  [res.code, place_order_response]
51
50
  end
52
51
 
53
- def fetch_quote(items)
52
+ def fetch_quote(items, account_number)
54
53
  payload = {
55
- 'accountNumber' => OreillyApi.account_number,
54
+ 'accountNumber' => account_number,
56
55
  'header' => {
57
56
  'identity' => OreillyApi.identity,
58
- 'payloadId' => OreillyApi.payload_id,
57
+ 'payloadId' => OreillyApi.payload_id(account_number),
59
58
  'timestamp' => Time.now.strftime("%Y-%m-%d %H:%M:%S")
60
59
  },
61
60
  'items' => items
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - TruptiHosmani
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-17 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler