48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/ctm/base.rb', line 48
def self.create(options)
list_type_path = options.delete(:list_type_path)
list_token_type = options.delete(:list_token_type)
account_id = options.delete(:account_id)
token = options.delete(:token)
path_str = "/api/v1/#{list_type_path}.json"
res = self.post(path_str, :body => options.merge(:auth_token => token))
if res.parsed_response['status'] == 'error'
raise CTM::Error::Create.new(res.parsed_response['reason'])
else
self.new(res.parsed_response[list_token_type.singularize], token)
end
end
|