Skip to content

Commit

Permalink
upgrade v3 sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
senid231 committed Feb 1, 2021
1 parent d6f7426 commit 3649db2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 26 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Expand Up @@ -12,8 +12,7 @@ gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'haml', '~> 5.0'
gem 'didww-v3', '~> 1.3.0', require: 'didww'
gem 'json_api_client', '~> 1.6.0'
gem 'didww-v3', github: 'didww/didww-v3-ruby', require: 'didww'
gem 'request_store', git: 'https://github.com/didww/request_store'
gem 'will_paginate'
gem 'will_paginate-bootstrap'
Expand Down
58 changes: 35 additions & 23 deletions Gemfile.lock
@@ -1,3 +1,14 @@
GIT
remote: https://github.com/didww/didww-v3-ruby.git
revision: 82c9dfb7842e6cf9bb48de691e22f7c8092e92f8
specs:
didww-v3 (1.3.0)
activesupport
down
faraday
http
json_api_client (= 1.18.0)

GIT
remote: https://github.com/didww/request_store
revision: a1ad88a093d0fde3c8c13cfcbe9a666de30f261c
Expand Down Expand Up @@ -79,16 +90,11 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.3)
didww-v3 (1.3.0)
activesupport
down
faraday
http
json_api_client
diff-lcs (1.3)
domain_name (0.5.20180417)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
down (4.5.0)
down (5.2.0)
addressable (~> 2.5)
erubi (1.7.0)
execjs (2.7.0)
factory_bot (4.8.2)
Expand All @@ -98,11 +104,15 @@ GEM
railties (>= 3.0.0)
faker (1.8.5)
i18n (~> 0.9.1)
faraday (0.15.3)
faraday (1.1.0)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
ruby2_keywords
faraday_middleware (1.0.0)
faraday (~> 1.0)
ffi (1.9.18)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
font-awesome-rails (4.7.0.2)
railties (>= 3.2, < 5.2)
formatador (0.2.5)
Expand Down Expand Up @@ -132,16 +142,17 @@ GEM
haml (5.0.4)
temple (>= 0.8.0)
tilt
http (3.3.0)
http (4.4.1)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
http-form_data (~> 2.2)
http-parser (~> 1.2.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (2.1.1)
http-form_data (2.3.0)
http-parser (1.2.3)
ffi-compiler (>= 1.0, < 2.0)
http_logger (0.5.1)
http_parser.rb (0.6.0)
i18n (0.9.1)
concurrent-ruby (~> 1.0)
jbuilder (2.7.0)
Expand All @@ -151,12 +162,13 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json_api_client (1.6.0)
json_api_client (1.18.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
addressable (~> 2.2)
faraday (~> 0.15, >= 0.15.2)
faraday_middleware (~> 0.9)
faraday (>= 0.15.2, < 1.2.0)
faraday_middleware (>= 0.9.0, < 1.2.0)
rack (>= 0.2)
launchy (2.4.3)
addressable (~> 2.3)
listen (3.1.5)
Expand All @@ -174,7 +186,7 @@ GEM
mini_portile2 (2.3.0)
minitest (5.10.3)
multi_json (1.12.2)
multipart-post (2.0.0)
multipart-post (2.1.1)
nenv (0.3.0)
nio4r (2.5.4)
nokogiri (1.8.1)
Expand Down Expand Up @@ -263,6 +275,7 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
ruby2_keywords (0.0.4)
ruby_dep (1.5.0)
rubyzip (1.3.0)
sass (3.5.4)
Expand Down Expand Up @@ -307,7 +320,7 @@ GEM
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unf_ext (0.0.7.7)
unicode-display_width (1.3.0)
web-console (3.5.1)
actionview (>= 5.0)
Expand All @@ -333,7 +346,7 @@ DEPENDENCIES
byebug
capybara (~> 2.13)
coffee-rails (~> 4.2)
didww-v3 (~> 1.3.0)
didww-v3!
factory_bot_rails
faker
font-awesome-rails
Expand All @@ -344,7 +357,6 @@ DEPENDENCIES
http_logger
jbuilder (~> 2.5)
jquery-rails
json_api_client (~> 1.6.0)
launchy
listen (>= 3.0.5, < 3.2)
pry-rails
Expand Down
9 changes: 8 additions & 1 deletion app/controllers/orders_controller.rb
Expand Up @@ -13,7 +13,7 @@ def new

def create
resource.items.each { |i| i.attributes.slice!(:sku_id, :qty, :available_did_id, :did_reservation_id, :capacity_pool_id) }
if resource.save
if order_save
respond_to do |fmt|
fmt.json do
render status: :created, json: { order: { id: resource.id } }
Expand Down Expand Up @@ -51,6 +51,13 @@ def destroy

private

def order_save
resource.save
rescue JsonApiClient::Errors::ClientError => e
resource.errors.add(:base, e.message)
false
end

def initialize_api_config
super.merge({
resource_type: :orders,
Expand Down

0 comments on commit 3649db2

Please sign in to comment.