Module: Croudia::API::SecretMails

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

Instance Method Summary collapse

Instance Method Details

#destroy_secret_mail(id, params = {}) ⇒ Croudia::SecretMail

Destroy a secret mail

Parameters:

  • id (String, Integer, Croudia::SecretMail)

    ID of the secret mail to delete

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

    Additional query params

Returns:

See Also:



83
84
85
86
# File 'lib/croudia/api/secret_mails.rb', line 83

def destroy_secret_mail(id, params={})
  resp = post("/secret_mails/destroy/#{get_id(id)}.json", params)
  Croudia::SecretMail.new(resp)
end

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

Get incoming secret mails

Parameters:

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

    Additional query parameters

Options Hash (params):

  • :count (String, Integer)

    Number of secret mails in the response

  • :max_id (String, Integer)

    Paging parameter

  • :since_id (String, Integer)

    Paging parameter

Returns:

See Also:



14
15
16
17
# File 'lib/croudia/api/secret_mails.rb', line 14

def secret_mails(params={})
  resp = get('/secret_mails.json', params)
  objects(Croudia::SecretMail, resp)
end

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

Get outgoing secret mails

Parameters:

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

    Additional query parameters

Options Hash (params):

  • :count (String, Integer)

    Number of secret mails in the response

  • :max_id (String, Integer)

    Paging parameter

  • :since_id (String, Integer)

    Paging parameter

Returns:

See Also:



27
28
29
30
# File 'lib/croudia/api/secret_mails.rb', line 27

def secret_mails_sent(params={})
  resp = get('/secret_mails/sent.json', params)
  objects(Croudia::SecretMail, resp)
end

#secret_photo(id) ⇒ String

Get an image attached to a secret mail

Parameters:

  • id (String, Integer)

    Image ID

Returns:

  • (String)

    Raw image

See Also:



104
105
106
# File 'lib/croudia/api/secret_mails.rb', line 104

def secret_photo(id)
  get("/secret_mails/get_secret_photo/#{id}")
end

#send_secret_mail(text, to_user, params = {}) ⇒ Croudia::SecretMail #send_secret_mail(params = {}) ⇒ Croudia::SecretMail

Send a new secret mail

Overloads:

  • #send_secret_mail(text, to_user, params = {}) ⇒ Croudia::SecretMail

    Parameters:

    • text (String)

      Message body

    • to_user (String, Integer, Croudia::User)

      Recipient user

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

      Additional query parameters

  • #send_secret_mail(params = {}) ⇒ Croudia::SecretMail

    Parameters:

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

      Query parameters

    Options Hash (params):

    • :screen_name (String)

      Screen name of the recipient

    • :text (String)

      Message body

    • :user_id (String, Integer)

      ID of the recipient

Returns:

See Also:



45
46
47
48
49
50
51
# File 'lib/croudia/api/secret_mails.rb', line 45

def send_secret_mail(text, to_user={}, params={})
  merge_text!(params, text, :text)
  merge_user!(params, to_user)

  resp = post('/secret_mails/new.json', params)
  Croudia::SecretMail.new(resp)
end

#send_secret_mail_with_media(text, to_user, media, params = {}) ⇒ Croudia::SecretMail #send_secret_mail_with_media(params = {}) ⇒ Croudia::SecretMail

Send a new secret mail with media

Overloads:

  • #send_secret_mail_with_media(text, to_user, media, params = {}) ⇒ Croudia::SecretMail

    Parameters:

    • text (String)

      Message body

    • to_user (String, Integer, Croudia::User)

      Recipient user

    • media (File, #to_io)

      Image to upload with

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

      Additional query parameters

  • #send_secret_mail_with_media(params = {}) ⇒ Croudia::SecretMail

    Parameters:

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

      Query parameters

    Options Hash (params):

    • :media (File, #to_io)

      Image to upload with

    • :screen_name (String)

      Screen name of the recipient

    • :text (String)

      Message body

    • :user_id (String, Integer)

      ID of the recipient

Returns:

See Also:



68
69
70
71
72
73
74
75
# File 'lib/croudia/api/secret_mails.rb', line 68

def send_secret_mail_with_media(text, to_user={}, media={}, params={})
  merge_text!(params, text, :text)
  merge_user!(params, to_user)
  merge_file!(params, media, :media)

  resp = post('/secret_mails/new_with_media.json')
  Croudia::SecretMail.new(resp)
end

#show_secret_mail(id, params = {}) ⇒ Croudia::SecretMail

Get a secret mail

Parameters:

  • id (String, Integer, Croudia::SecretMail)

    ID of the secret mail to get

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

    Additional query parameters

Returns:

See Also:



94
95
96
97
# File 'lib/croudia/api/secret_mails.rb', line 94

def show_secret_mail(id, params={})
  resp = get("/secret_mails/show/#{get_id(id)}.json", params)
  Croudia::SecretMail.new(resp)
end