Class: Chatwork::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/chatwork/base.rb

Overview

ChatworkのAPI通信をする際の基底クラス

APIキーの設定やフォーマッタの設定など、共通で必要な設定をここで行うChatwork APIを扱う際にはこのクラスを継承すること

Direct Known Subclasses

Contact, File, IncomingRequest, Member, Message, My, Room, Task

Instance Method Summary collapse

Instance Method Details

#to_json(options = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/chatwork/base.rb', line 36

def to_json(options = {})
  json = if include_root_in_json
           super({ root: self.class.element_name }.merge(options))
         else
           super(options)
         end
  hash = JSON.parse(json)

  URI.encode_www_form(hash)
end