diff --git a/lib/xpm_ruby/schema/client/add.rb b/lib/xpm_ruby/schema/client/add.rb index 129335f..f2c9f07 100644 --- a/lib/xpm_ruby/schema/client/add.rb +++ b/lib/xpm_ruby/schema/client/add.rb @@ -25,16 +25,14 @@ module Client AccountManagerID?: Types::String, Contacts?: Types::Array.of( Types::Hash.schema( - Contact: Types::Hash.schema( - Name: Types::String, - IsPrimary?: Types::String, - Salutation?: Types::String, - Addressee?: Types::String, - Phone?: Types::Coercible::String, - Mobile?: Types::Coercible::String, - Email?: Types::String, - Position?: Types::String - ).with_key_transform(&:to_sym) + Name: Types::String, + IsPrimary?: Types::String, + Salutation?: Types::String, + Addressee?: Types::String, + Phone?: Types::Coercible::String, + Mobile?: Types::Coercible::String, + Email?: Types::String, + Position?: Types::String ).with_key_transform(&:to_sym) ), BillingClientID?: Types::Coercible::String, diff --git a/lib/xpm_ruby/schema/client/update.rb b/lib/xpm_ruby/schema/client/update.rb index a02ef6c..a5e0047 100644 --- a/lib/xpm_ruby/schema/client/update.rb +++ b/lib/xpm_ruby/schema/client/update.rb @@ -26,16 +26,14 @@ module Client AccountManagerID?: Types::String, Contacts?: Types::Array.of( Types::Hash.schema( - Contact: Types::Hash.schema( - Name: Types::String, - IsPrimary?: Types::String, - Salutation?: Types::String, - Addressee?: Types::String, - Phone?: Types::Coercible::String, - Mobile?: Types::Coercible::String, - Email?: Types::String, - Position?: Types::String - ).with_key_transform(&:to_sym) + Name: Types::String, + IsPrimary?: Types::String, + Salutation?: Types::String, + Addressee?: Types::String, + Phone?: Types::Coercible::String, + Mobile?: Types::Coercible::String, + Email?: Types::String, + Position?: Types::String ).with_key_transform(&:to_sym) ), BillingClientID?: Types::Coercible::String, diff --git a/spec/xpm_ruby/schema/client/add_spec.rb b/spec/xpm_ruby/schema/client/add_spec.rb index f6406e0..e275486 100644 --- a/spec/xpm_ruby/schema/client/add_spec.rb +++ b/spec/xpm_ruby/schema/client/add_spec.rb @@ -6,7 +6,7 @@ module Schema context "with a valid Add schema" do context "with contacts" do it "should not raise an error" do - hash = { "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Contact" => { "Name" => "Joe Bloggs" } }] } + hash = { "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Name" => "Joe Bloggs" }] } expect { Client::Add[hash] }.not_to raise_error end end @@ -32,7 +32,7 @@ module Schema end it "should raise an error on contacts" do - hash = { "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Contact" => { "Email" => "Joe Bloggs" } }] } + hash = { "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Email" => "Joe Bloggs" }] } expect { Client::Add[hash] }.to raise_error(Dry::Types::SchemaError, /Name is missing in Hash input/) end end diff --git a/spec/xpm_ruby/schema/client/update_spec.rb b/spec/xpm_ruby/schema/client/update_spec.rb index a3ca8a7..ef32e95 100644 --- a/spec/xpm_ruby/schema/client/update_spec.rb +++ b/spec/xpm_ruby/schema/client/update_spec.rb @@ -6,7 +6,7 @@ module Schema context "with a valid Update schema" do context "with contacts" do it "should not raise an error" do - hash = { "ID" => 25655881, "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Contact" => { "Name" => "Joe Bloggs" } }] } + hash = { "ID" => 25655881, "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Name" => "Joe Bloggs" }] } expect { Client::Update[hash] }.not_to raise_error end end @@ -32,7 +32,7 @@ module Schema end it "should raise an error on contacts" do - hash = { "ID" => 25655881, "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Contact" => { "Email" => "Joe Bloggs" } }] } + hash = { "ID" => 25655881, "Name" => "Joe Bloggs Consulting", "Contacts" => [{ "Email" => "Joe Bloggs" }] } expect { Client::Update[hash] }.to raise_error(Dry::Types::SchemaError, /Name is missing in Hash input/) end end