From eca1537f966c36d6d22b944f50c91a632a6c8f97 Mon Sep 17 00:00:00 2001 From: Oskar Niburski Date: Tue, 23 Mar 2021 18:28:36 -0700 Subject: [PATCH 1/2] missing cols for orders --- lib/shopify/adapters/http.ex | 5 ++++- lib/shopify/resources/inventory_level.ex | 3 ++- lib/shopify/resources/order.ex | 3 +++ test/adapters/http_test.exs | 17 ++++++++++------- test/shopify_payments/payout_test.exs | 16 ++++++++++++++-- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lib/shopify/adapters/http.ex b/lib/shopify/adapters/http.ex index 16db437..af10d22 100644 --- a/lib/shopify/adapters/http.ex +++ b/lib/shopify/adapters/http.ex @@ -29,7 +29,10 @@ defmodule Shopify.Adapters.HTTP do end def handle_response({:ok, %HTTPoison.Response{} = resp}, resource) do - Shopify.Response.new(%{body: resp.body, code: resp.status_code, headers: resp.headers}, resource) + Shopify.Response.new( + %{body: resp.body, code: resp.status_code, headers: resp.headers}, + resource + ) end def handle_response({:error, %HTTPoison.Error{reason: reason}}, _resource) do diff --git a/lib/shopify/resources/inventory_level.ex b/lib/shopify/resources/inventory_level.ex index c796d60..5adb79f 100644 --- a/lib/shopify/resources/inventory_level.ex +++ b/lib/shopify/resources/inventory_level.ex @@ -134,5 +134,6 @@ defmodule Shopify.InventoryLevel do @doc false def all_url, do: @plural <> ".json" - defp unprocessable_entity(msg), do: Shopify.Response.new(%{body: msg, code: 422, headers: []}, empty_resource()) + defp unprocessable_entity(msg), + do: Shopify.Response.new(%{body: msg, code: 422, headers: []}, empty_resource()) end diff --git a/lib/shopify/resources/order.ex b/lib/shopify/resources/order.ex index 4130029..06cfbd0 100644 --- a/lib/shopify/resources/order.ex +++ b/lib/shopify/resources/order.ex @@ -30,6 +30,9 @@ defmodule Shopify.Order do } defstruct [ + :send_receipt, + :send_fulfillment_receipt, + :inventory_behaviour, :billing_address, :browser_ip, :buyer_accepts_marketing, diff --git a/test/adapters/http_test.exs b/test/adapters/http_test.exs index 07b244a..f9ab380 100644 --- a/test/adapters/http_test.exs +++ b/test/adapters/http_test.exs @@ -10,13 +10,16 @@ defmodule Shopify.Adapters.HTTPTest do end test "it returns correct Response struct" do - result = {:ok, %HTTPoison.Response{ - body: "{\"product\":{\"id\":123}}", - headers: [{"X-Shopify-Shop-Api-Call-Limit", "1/80"}], - status_code: 200 - }} - - assert {:ok, %Response{} = response} = HTTP.handle_response(result, %{"product" => %Product{}}) + result = + {:ok, + %HTTPoison.Response{ + body: "{\"product\":{\"id\":123}}", + headers: [{"X-Shopify-Shop-Api-Call-Limit", "1/80"}], + status_code: 200 + }} + + assert {:ok, %Response{} = response} = + HTTP.handle_response(result, %{"product" => %Product{}}) assert response.code == 200 assert response.data == %Product{id: 123} diff --git a/test/shopify_payments/payout_test.exs b/test/shopify_payments/payout_test.exs index f2b4a82..0108434 100644 --- a/test/shopify_payments/payout_test.exs +++ b/test/shopify_payments/payout_test.exs @@ -7,7 +7,14 @@ defmodule Shopify.ShopifyPayments.PayoutTest do assert {:ok, response} = Shopify.session() |> Payout.find(1) assert %Shopify.Response{} = response assert 200 == response.code - fixture = Fixture.load("../test/fixtures/shopify_payments/payouts/1.json", "payout", Payout.empty_resource()) + + fixture = + Fixture.load( + "../test/fixtures/shopify_payments/payouts/1.json", + "payout", + Payout.empty_resource() + ) + assert fixture == response.data end @@ -15,7 +22,12 @@ defmodule Shopify.ShopifyPayments.PayoutTest do assert {:ok, response} = Shopify.session() |> Payout.all() assert %Shopify.Response{} = response assert 200 == response.code - fixture = Fixture.load("../test/fixtures/shopify_payments/payouts.json", "payouts", [Payout.empty_resource()]) + + fixture = + Fixture.load("../test/fixtures/shopify_payments/payouts.json", "payouts", [ + Payout.empty_resource() + ]) + assert fixture == response.data end end From f86095648752c8fa802561b883cd260159332e69 Mon Sep 17 00:00:00 2001 From: Oskar Niburski Date: Fri, 28 May 2021 12:36:09 -0700 Subject: [PATCH 2/2] missing collects --- lib/shopify/resources/image.ex | 4 +++- lib/shopify/resources/page.ex | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/shopify/resources/image.ex b/lib/shopify/resources/image.ex index 643e51d..741a868 100644 --- a/lib/shopify/resources/image.ex +++ b/lib/shopify/resources/image.ex @@ -25,7 +25,9 @@ defmodule Shopify.Image do :product_id, :src, :updated_at, - :variant_ids + :variant_ids, + :width, + :height ] @doc false diff --git a/lib/shopify/resources/page.ex b/lib/shopify/resources/page.ex index 6139581..3e18e52 100644 --- a/lib/shopify/resources/page.ex +++ b/lib/shopify/resources/page.ex @@ -26,7 +26,8 @@ defmodule Shopify.Page do :published_at, :template_suffix, :published, - :metafields + :metafields, + :collects ] @doc false