Sha256: cc031a56d378935b4a2d6814482e3217b52507d1d1c774dfcfa312bd4265e575

Contents?: true

Size: 791 Bytes

Versions: 9

Compression:

Stored size: 791 Bytes

Contents

module RedboothRuby
  module Operations
    module Create
      module ClassMethods
        # Creates a new object
        #
        # @param [Hash] attributes The attributes of the created object
        def create(attributes)
          session = attributes.delete(:session)
          response = RedboothRuby.request(:post,
                                          nil,
                                          api_collection_url(attributes),
                                          attributes,
                                          options_for_request(session: session)
                                         )
          new(response.data.merge(session: session))
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
redbooth-ruby-0.2.3 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.2.2 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.2.1 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.2.0 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.1.4 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.1.3 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.1.1 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.1.0 lib/redbooth-ruby/operations/create.rb
redbooth-ruby-0.0.5 lib/redbooth-ruby/operations/create.rb