Skip to content

Commit

Permalink
Add page parameter support
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Sep 11, 2024
1 parent 629ba0c commit c0eeea3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/pakman/instellar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ defmodule Pakman.Instellar do

sizes = Map.get(configuration, "sizes")
plans = Map.get(configuration, "plans")
page = Map.get(configuration, "page")

configuration_params = %{
payload: %{
Expand Down Expand Up @@ -133,6 +134,16 @@ defmodule Pakman.Instellar do
configuration_params
end

configuration_params =
if page do
payload = configuration_params.payload
payload = Map.put(payload, :page, page)

Map.put(configuration_params, :payload, payload)
else
configuration_params
end

client()
|> post(
"/publish/deployments/#{deployment_id}/configurations",
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ plans:
{ amount: 1500, currency: USD, billing_period: monthly },
{ amount: 15000, currency: USD, billing_period: yearly },
]

page:
title: "SomeApp"
slogan: "SomeApp is a web application"
description: "Some description about SomeApp."
12 changes: 10 additions & 2 deletions test/pakman/instellar_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ defmodule Pakman.InstellarTest do
assert %{"configuration" => %{"payload" => payload}} =
Jason.decode!(body)

assert %{"kits" => _kits, "sizes" => sizes, "plans" => plans} =
payload
assert %{
"kits" => _kits,
"sizes" => sizes,
"plans" => plans,
"page" => %{
"title" => _title,
"slogan" => _slogan,
"description" => _description
}
} = payload

assert Enum.count(sizes) == 1

Expand Down

0 comments on commit c0eeea3

Please sign in to comment.