Module: ChatWork::Operations

Included in:
Entity
Defined in:
lib/chatwork/operations.rb

Constant Summary collapse

ACCEPT_PARAMS_ID =
%i(file_id task_id message_id)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#assign_pathObject

Returns the value of attribute assign_path.



5
6
7
# File 'lib/chatwork/operations.rb', line 5

def assign_path
  @assign_path
end

Instance Method Details

#define_createObject



22
23
24
25
26
27
28
29
30
# File 'lib/chatwork/operations.rb', line 22

def define_create
  instance_eval do
    def create(params = {})
      @assign_path = parse_if_hash_key_exists(path, params, :room_id)
      attach_nested_resource_id(params)
      convert(ChatWork.client.post(@assign_path, params))
    end
  end
end

#define_getObject



12
13
14
15
16
17
18
19
20
# File 'lib/chatwork/operations.rb', line 12

def define_get
  instance_eval do
    def get(params = {})
      @assign_path = parse_if_hash_key_exists(path, params, :room_id)
      attach_nested_resource_id(params)
      convert(ChatWork.client.get(@assign_path, params))
    end
  end
end

#install_class_operations(*operations) ⇒ Object



7
8
9
10
# File 'lib/chatwork/operations.rb', line 7

def install_class_operations(*operations)
  define_create if operations.include?(:create)
  define_get if operations.include?(:get)
end