Module: ChatWork::Operations
- Included in:
- Entity
- Defined in:
- lib/chatwork/operations.rb
Instance Method Summary collapse
Instance Method Details
#define_create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/chatwork/operations.rb', line 16 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 |
#define_get ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/chatwork/operations.rb', line 8 def define_get instance_eval do def get(params = {}) convert(ChatWork.client.get(path, params)) end end end |
#install_class_operations(*operations) ⇒ Object
3 4 5 6 |
# File 'lib/chatwork/operations.rb', line 3 def install_class_operations(*operations) define_create if operations.include?(:create) define_get if operations.include?(:get) end |