Sha256: ec0cfa8cdf9884eeb60da53e67e54e2170bc8a860c8acca7ce624e10a9532f4b

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

module ChatWork
  module Operations
    def install_class_operations(*operations)
      define_create if operations.include?(:create)
    end

    def define_create
      instance_eval do
        def create(params = {})
          # TODO: Consider other pattern
          # /rooms and /rooms/:room_id
          assign_path = if params.include?(:room_id)
            path % params.delete(:room_id)
          else
            path
          end
          convert(ChatWork.client.post(assign_path, params))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chatwork-0.0.3 lib/chatwork/operations.rb