Sha256: 413325863da1aba8613e16b0f0ef42d67735c88cefbe059f4d4d72f51e422fa3
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require "ribose/actions/base" module Ribose module Actions module Create extend Ribose::Actions::Base def create response = create_resource response[resource] || response end private # Attribute validations # # This method will be invoked by the create action to validate the # attributes before submitting to the actual endpoint. We can override # this one to validate user provider attributes. # def validate(attributes) attributes end def request_body(attributes) custom_option.merge(resource_key.to_sym => validate(**attributes)) end def create_resource Ribose::Request.post(resources_path, request_body(attributes)) end module ClassMethods # Create resource # # @param attributes [Hash] Resoruce attributes # @return [Sawyer::Resource] Newly created resource # def create(attributes) new(attributes).create end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ribose-0.5.0 | lib/ribose/actions/create.rb |