This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# | |
# Table name: shipments | |
# | |
# id :integer not null, primary key | |
# number :string(255) | |
# order_number :string(255) | |
# shipping_address_id :integer | |
# status :string(255) | |
# tracking :string(255) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@doc """ | |
Parses | |
## Examples | |
iex>params_string = "name=Baloo&type=Brown" | |
iex>Servy.Parser.parse_params("application/x-www-form-urlencoded", | |
%{"name" => "Baloo", "type" => "Brown"}) | |
iex>Servy.Parser.parse_params("multipart/form-data", params_string, %{}) | |
""" | |
def parse_params("application/x-www-form-urlencoded", params_string) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rails_helper" | |
describe ServiceOptionsSlot do | |
include_context "supports soft delete" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create(conv, %{"name" => name, "type" => type} = _params) do | |
%{ conv | status: 201, | |
resp_body: "Created a #{type} bear named #{name}" } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_headers(header_lines) do | |
Enum.reduce(header_lines, %{}, fn(line, headers) -> | |
[key, value] = String.split(line, ":") | |
Map.put(headers, key, value) | |
end) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "dry-struct" | |
require_relative "../../../../../app/services/inventory/flexe/types" | |
require_relative "../../../../../app/services/inventory/flexe/deliveries/container_delivery_details" | |
describe Inventory::Flexe::Deliveries::ContainerDeliveryDetails do | |
let(:container_delivery_details_attrs) do | |
{ | |
shipment_id: "1", | |
shipment_type: "container_delivery", | |
reservation_id: "34543", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Recurse do | |
def sum([head | tail], accu) do | |
sum(tail, accu + head) | |
end | |
def sum([], accu), do: accu | |
end | |
IO.puts "Total: #{Recurse.sum([1,2,3,4,5], 0)}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# | |
# Table name: shipment_errors | |
# | |
# id :integer not null, primary key | |
# shipment_id :integer | |
# handled_by_id :integer | |
# message :text | |
# created_at :datetime | |
# deleted_at :datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Servy.Conv do | |
alias Servy.Conv | |
defstruct method: "", path: "", resp_body: "", status: nil | |
def full_status(%Conv{} = conv) do | |
"#{conv.status} #{status_reason(conv.status)}" | |
end | |
defp status_reason(code) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Fulfillment | |
module BulkShipments | |
module Types | |
include Dry::Types.module | |
end | |
class PalletLabels < Dry::Struct | |
HEADER_PADDING = 20 | |
constructor_type :strict_with_defaults |