Aws sdk cloudwatch metric pattern creation - Newbie

Am trying to create aws cloudwatch metric pattern creation aws ruby sdk, unfortunately I could not find any sample code in aws documentation. could someone help to create cloudwatch alarm for a log group with below metric pattern
“[w1,w2,w3,w4,w5!=*10.1.1.1*&&w5!=“10.1.1.2”,w5=*test*”]"