Module: ChatWork::File

Extended by:
EntityMethods
Defined in:
lib/chatwork/file.rb

Class Method Summary collapse

Class Method Details

.find(room_id:, file_id:, create_download_url: nil) ⇒ Hashie::Mash

Get information about the specified file

Examples:

response format

{
  "file_id":3,
  "account": {
    "account_id":123,
    "name":"Bob",
    "avatar_image_url": "https://example.com/ico_avatar.png"
  },
  "message_id": "22",
  "filename": "README.md",
  "filesize": 2232,
  "upload_time": 1384414750
}

Parameters:

  • room_id (Integer)
  • file_id (Integer)
  • create_download_url (Boolean) (defaults to: nil)

    whether or not to create a download link. If set to true, download like will be created for 30 seconds

Returns:

  • (Hashie::Mash)

See Also:



59
60
61
# File 'lib/chatwork/file.rb', line 59

def self.find(room_id:, file_id:, create_download_url: nil)
  _get("/rooms/#{room_id}/files/#{file_id}", create_download_url: boolean_to_integer(create_download_url))
end

.get(room_id:, account_id:) ⇒ Array<Hashie::Mash>

Get the list of files associated with the specified chat

Examples:

response format

[
  {
    "file_id": 3,
    "account": {
      "account_id": 123,
      "name": "Bob",
      "avatar_image_url": "https://example.com/ico_avatar.png"
    },
    "message_id": "22",
    "filename": "README.md",
    "filesize": 2232,
    "upload_time": 1384414750
  }
]

Parameters:

  • room_id (Integer)
  • account_id (Integer)

Returns:

  • (Array<Hashie::Mash>)

See Also:



30
31
32
# File 'lib/chatwork/file.rb', line 30

def self.get(room_id:, account_id:)
  _get("/rooms/#{room_id}/files", account_id: )
end