Method: Warrant::Object.create
- Defined in:
- lib/warrant/models/object.rb
.create(params = {}, options = {}) ⇒ Object
Creates an object with the given parameters
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/warrant/models/object.rb', line 32 def self.create(params = {}, = {}) res = APIOperations.post(URI.parse("#{::Warrant.config.api_base}/v2/objects"), params: Util.normalize_params(params), options: ) case res when Net::HTTPSuccess res_json = JSON.parse(res.body, symbolize_names: true) Object.new(res_json[:objectType], res_json[:objectId], res_json[:meta], res_json[:createdAt]) else APIOperations.raise_error(res) end end |