Module: Croudia::Rest::SecretMails

Included in:
Client
Defined in:
lib/croudia/rest/secret_mails.rb

Instance Method Summary collapse

Instance Method Details

#delete_message(status) ⇒ Croudia::Object::SecretMail

Deletes the authenticating user’s sent message.

Parameters:

Returns:

See Also:



71
72
73
74
# File 'lib/croudia/rest/secret_mails.rb', line 71

def delete_message(status)
  response = post("secret_mails/destroy/#{status.id}.json")
  Croudia::Object::SecretMail.new(response)
end

#message(status) ⇒ Croudia::Object::SecretMail

Returns a single message, specified by the id parameter.

Parameters:

Returns:

See Also:



81
82
83
84
# File 'lib/croudia/rest/secret_mails.rb', line 81

def message(status)
  response = get("secret_mails/show/#{status.id}.json")
  Croudia::Object::SecretMail.new(response)
end

#message_photo(status) ⇒ String

Returns the URI of the image that attached to message.

Parameters:

Returns:

  • (String)

    URL of attaching message.

See Also:



91
92
93
# File 'lib/croudia/rest/secret_mails.rb', line 91

def message_photo(status)
  "https://api.croudia.com/secret_mails/get_secret_photo/#{status.id}.json"
end

#new_message(params = {}) ⇒ Croudia::Object::SecretMail

Sends a new message to the specified user from the authenticating user.

Parameters:

  • params (Hash) (defaults to: {})

    A customized options.

Options Hash (params):

  • :text (String)

    The text of your status update, typically up to 372 characters.

  • :screen_name (String)

    The screen name of the user for whom to send message.

  • :user_id (Integer)

    The ID of the user for whom to send message.

Returns:

See Also:



47
48
49
50
# File 'lib/croudia/rest/secret_mails.rb', line 47

def new_message(params = {})
  response = post('secret_mails/new.json', params)
  Croudia::Object::SecretMail.new(response)
end

#new_message_with_media(params = {}) ⇒ Croudia::Object::SecretMail

Sends a new message with image to the specified user from the authenticating user.

Parameters:

  • params (Hash) (defaults to: {})

    A customized options.

Options Hash (params):

  • :text (String)

    The text of your status update, typically up to 372 characters.

  • :media (File)

    Attachment image as PNG, JPEG or GIF format.

  • :screen_name (String)

    The screen name of the user for whom to send message.

  • :user_id (Integer)

    The ID of the user for whom to send message.

Returns:

See Also:



61
62
63
64
# File 'lib/croudia/rest/secret_mails.rb', line 61

def new_message_with_media(params = {})
  response = post('secret_mails/new_with_media.json', params)
  Croudia::Object::SecretMail.new(response)
end

#received(params = {}) ⇒ Array<Croudia::Object::SecretMail>

Returns the 20 most recent direct messages sent to the authenticating user.

Parameters:

  • params (Hash) (defaults to: {})

    A customized options.

Options Hash (params):

  • :trim_user (Boolean)

    When set to true, each message returned in a timeline will include a user object including only the status authors numerical ID.

  • :since_id (Integer)

    Returns results with an ID greater than (that is, more recent than) the specified ID.

  • :max_id (Integer)

    Returns results with an ID less than (that is, older than) or equal to the specified ID.

  • :count (Integer)

    Specifies the number of statuses to retrieve.

Returns:

See Also:



16
17
18
19
20
21
# File 'lib/croudia/rest/secret_mails.rb', line 16

def received(params = {})
  response = get('secret_mails.json', params)
  response.map do |sm|
    Croudia::Object::SecretMail.new(sm)
  end
end

#sent(params = {}) ⇒ Array<Croudia::Object::SecretMail>

Returns the 20 most recent direct messages sent by the authenticating user.

Parameters:

  • params (Hash) (defaults to: {})

    A customized options.

Options Hash (params):

  • :trim_user (Boolean)

    When set to true, each message returned in a timeline will include a user object including only the status authors numerical ID.

  • :since_id (Integer)

    Returns results with an ID greater than (that is, more recent than) the specified ID.

  • :max_id (Integer)

    Returns results with an ID less than (that is, older than) or equal to the specified ID.

  • :count (Integer)

    Specifies the number of statuses to retrieve.

Returns:

See Also:



32
33
34
35
36
37
# File 'lib/croudia/rest/secret_mails.rb', line 32

def sent(params = {})
  response = get('secret_mails/sent.json', params)
  response.map do |sm|
    Croudia::Object::SecretMail.new(sm)
  end
end