Module: TreezorConnect::ApiOperations::CreateOperation
- Included in:
- Create, NestedCreate
- Defined in:
- lib/treezor_connect/api_operations/create_operation.rb
Instance Method Summary collapse
Instance Method Details
#build_object_from_response(response) ⇒ Object
15 16 17 18 |
# File 'lib/treezor_connect/api_operations/create_operation.rb', line 15 def build_object_from_response(response) data = extract_response_data(response, extract_all_objects: false) Util.convert_to_treezor_object(data, { object_class: self::OBJECT_NAME }) end |
#perform_create(url, params, access_token) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/treezor_connect/api_operations/create_operation.rb', line 6 def perform_create(url, params, access_token) response = request(:post, url, params: { body: params }, access_token:) build_object_from_response(response) rescue AlreadyCreatedError => e e.object = build_object_from_response(e.treezor_response) e.treezor_response = nil raise end |