RDC 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/RDC.rb +6 -1
- data/lib/RDC/cart.rb +3 -3
- data/lib/RDC/order.rb +24 -0
- data/lib/RDC/request.rb +9 -2
- data/lib/RDC/sku.rb +5 -5
- data/lib/RDC/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f852867ecebeb1a86b0c8a91a7c2f4a3d637b30767d919cba6d578ed89d77a4f
|
4
|
+
data.tar.gz: a82a6beb5364f4f8c4224a8494f775a0363e4c299c0a82461d2e6e338f2da290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d014649ea7c22cebd3a00cbfe4d4c346fc9c717d89debe169d798b7c31d1ed542ed1c6e0049a3753645faf908d2cf08ad9ebae4268481e214c311af9c0ff9b6e
|
7
|
+
data.tar.gz: 5b9626d8490497f1da0dc87219abd0b570103baec86fa61af533c1fd6a3a72ba9051434340df35f16bba2df70ad17e75aa8e21655be740b66e2cd7e5aeabc0f5
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
RDC (0.1.
|
4
|
+
RDC (0.1.3)
|
5
5
|
activesupport (= 5.2.3)
|
6
6
|
net-sftp (= 3.0.0)
|
7
|
-
rubyzip
|
7
|
+
rubyzip
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
@@ -89,4 +89,4 @@ DEPENDENCIES
|
|
89
89
|
webmock
|
90
90
|
|
91
91
|
BUNDLED WITH
|
92
|
-
2.1.
|
92
|
+
2.1.4
|
data/lib/RDC.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "RDC/version"
|
2
4
|
require "RDC/catalog"
|
3
|
-
require "RDC/
|
5
|
+
require "RDC/order"
|
6
|
+
require "RDC/sku"
|
7
|
+
require "RDC/cart"
|
4
8
|
|
5
9
|
module RDC
|
6
10
|
class Error < StandardError; end
|
@@ -8,6 +12,7 @@ module RDC
|
|
8
12
|
class << self
|
9
13
|
attr_accessor :api_key, :environment
|
10
14
|
attr_accessor :ftp_username, :ftp_password, :ftp_url
|
15
|
+
attr_accessor :prti
|
11
16
|
|
12
17
|
def root
|
13
18
|
File.dirname __dir__
|
data/lib/RDC/cart.rb
CHANGED
@@ -5,9 +5,9 @@ require 'RDC/request'
|
|
5
5
|
module RDC
|
6
6
|
class Cart
|
7
7
|
class << self
|
8
|
-
def create(
|
9
|
-
request = Request.new("/
|
10
|
-
reponse = request.get
|
8
|
+
def create(params)
|
9
|
+
request = Request.new("/create_shopping_cart_id")
|
10
|
+
reponse = request.get(params)
|
11
11
|
response.json
|
12
12
|
end
|
13
13
|
end
|
data/lib/RDC/order.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'request'
|
4
|
+
|
5
|
+
module RDC
|
6
|
+
class Order
|
7
|
+
class << self
|
8
|
+
def process_order_body(params = {})
|
9
|
+
request = Request.new("/process_order_body")
|
10
|
+
response = request.post(params.merge(prti_params(params)))
|
11
|
+
response.json
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def prti_params(params)
|
17
|
+
{
|
18
|
+
prti: RDC.prti,
|
19
|
+
partneradid: RDC.prti
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/RDC/request.rb
CHANGED
@@ -12,9 +12,9 @@ module RDC
|
|
12
12
|
|
13
13
|
def base_url
|
14
14
|
if RDC.environment == 'production'
|
15
|
-
'http://connect.restaurant.com/api'
|
15
|
+
'http://connect.restaurant.com/api'.freeze
|
16
16
|
else
|
17
|
-
'https://dev-connect.restaurant.com/api'
|
17
|
+
'https://dev-connect.restaurant.com/api'.freeze
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -25,6 +25,13 @@ module RDC
|
|
25
25
|
self
|
26
26
|
end
|
27
27
|
|
28
|
+
def post(params = {})
|
29
|
+
self.response = HTTP.headers(headers)
|
30
|
+
.post(url, { json: params })
|
31
|
+
self.json = JSON.parse(response.body.to_s, symbolize_names: true)
|
32
|
+
self
|
33
|
+
end
|
34
|
+
|
28
35
|
def url
|
29
36
|
"#{base_url}#{path}"
|
30
37
|
end
|
data/lib/RDC/sku.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'request'
|
4
4
|
|
5
5
|
module RDC
|
6
6
|
class Sku
|
7
7
|
class << self
|
8
8
|
def validate(sku_id)
|
9
|
-
request = Request.new("/validate_sku
|
10
|
-
|
9
|
+
request = Request.new("/validate_sku/?sku=#{sku_id}")
|
10
|
+
response = request.get
|
11
11
|
response.json
|
12
12
|
end
|
13
13
|
|
14
14
|
def verify_inventory_and_price(skus)
|
15
|
-
request = Request.new("/verify_inventory_and_price
|
16
|
-
|
15
|
+
request = Request.new("/verify_inventory_and_price/?sku=#{skus}")
|
16
|
+
response = request.get
|
17
17
|
response.json
|
18
18
|
end
|
19
19
|
end
|
data/lib/RDC/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RDC
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- davidrichey
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-12-
|
12
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/RDC/cart.rb
|
76
76
|
- lib/RDC/catalog.rb
|
77
77
|
- lib/RDC/item.rb
|
78
|
+
- lib/RDC/order.rb
|
78
79
|
- lib/RDC/request.rb
|
79
80
|
- lib/RDC/restaurant.rb
|
80
81
|
- lib/RDC/restaurant_info.rb
|