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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6c902ed5c633045a9501d5f7578705f1d67a5975ced6f66c231bd631f57c153
4
- data.tar.gz: 30f3ba68d806b9a8ee0f996c0c78354ab65699d2a03d92cee77864e1635fae08
3
+ metadata.gz: f852867ecebeb1a86b0c8a91a7c2f4a3d637b30767d919cba6d578ed89d77a4f
4
+ data.tar.gz: a82a6beb5364f4f8c4224a8494f775a0363e4c299c0a82461d2e6e338f2da290
5
5
  SHA512:
6
- metadata.gz: b0cc47b940d8b7913703296d5ad912f639beb19c53451c3d781d45a5d9e54f140d981ad468c4b8de0178d369791903afd5310db13b4d01be561930f2c325395f
7
- data.tar.gz: 36d2711b5c4ffc591fff418a42f0df3a01f5500cbae41809f931a96efd03e688800f0330feda2102237e998133ec33ff6414f0c4ea1969b6aa3a5d005631060a
6
+ metadata.gz: d014649ea7c22cebd3a00cbfe4d4c346fc9c717d89debe169d798b7c31d1ed542ed1c6e0049a3753645faf908d2cf08ad9ebae4268481e214c311af9c0ff9b6e
7
+ data.tar.gz: 5b9626d8490497f1da0dc87219abd0b570103baec86fa61af533c1fd6a3a72ba9051434340df35f16bba2df70ad17e75aa8e21655be740b66e2cd7e5aeabc0f5
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- RDC (0.1.0)
4
+ RDC (0.1.3)
5
5
  activesupport (= 5.2.3)
6
6
  net-sftp (= 3.0.0)
7
- rubyzip (= 2.3.0)
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.2
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/restaurant_info"
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__
@@ -5,9 +5,9 @@ require 'RDC/request'
5
5
  module RDC
6
6
  class Cart
7
7
  class << self
8
- def create(sku_id)
9
- request = Request.new("/validate_sku?sku=#{sku_id}")
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
@@ -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
@@ -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
@@ -1,19 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'RDC/request'
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?sku=#{sku_id}")
10
- reponse = request.get
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?sku=#{skus}")
16
- reponse = request.get
15
+ request = Request.new("/verify_inventory_and_price/?sku=#{skus}")
16
+ response = request.get
17
17
  response.json
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module RDC
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-08 00:00:00.000000000 Z
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