Class: Rmb::Drop

Inherits:
Resource show all
Defined in:
lib/rmb/drop.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

client, #initialize

Constructor Details

This class inherits a constructor from Rmb::Resource

Instance Attribute Details

#admin_emailObject

Returns the value of attribute admin_email.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def admin_email
  @admin_email
end

#admin_passwordObject

Returns the value of attribute admin_password.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def admin_password
  @admin_password
end

#asset_countObject

Returns the value of attribute asset_count.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def asset_count
  @asset_count
end

#chat_passwordObject

Returns the value of attribute chat_password.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def chat_password
  @chat_password
end

#current_bytesObject

Returns the value of attribute current_bytes.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def current_bytes
  @current_bytes
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def description
  @description
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def email
  @email
end

#email_keyObject

Returns the value of attribute email_key.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def email_key
  @email_key
end

#expiration_lengthObject

Returns the value of attribute expiration_length.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def expiration_length
  @expiration_length
end

#expires_atObject

Returns the value of attribute expires_at.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def expires_at
  @expires_at
end

#max_bytesObject

Returns the value of attribute max_bytes.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def max_bytes
  @max_bytes
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def name
  @name
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/rmb/drop.rb', line 3

def password
  @password
end

Class Method Details

.create(attributes = {}) ⇒ Object

Creates a drop with an attributes hash. Valid attributes: name (string), expiration_length (string), password (string), and admin_password (string) Descriptions can be found here: backbonedocs.drop.io/Ruby-API-Client-Library:Drop



25
26
27
# File 'lib/rmb/drop.rb', line 25

def self.create(attributes = {})
  Rmb::Resource.client.create_drop(attributes)
end

.find(name) ⇒ Object

Finds a drop with name



13
14
15
# File 'lib/rmb/drop.rb', line 13

def self.find(name)
  Rmb::Resource.client.drop(name)
end

.find_all(page = 1) ⇒ Object

Finds all the drops associated with an API account by page



18
19
20
# File 'lib/rmb/drop.rb', line 18

def self.find_all(page = 1)
  Rmb::Resource.client.all_drops(page)
end

Instance Method Details

#add_file(file_path, description = nil, convert_to = nil, pingback_url = nil, output_locations = nil) ⇒ Object

Adds a file to the Drop given the file_path.



60
61
62
# File 'lib/rmb/drop.rb', line 60

def add_file(file_path, description = nil, convert_to = nil, pingback_url = nil, output_locations = nil)
  Rmb::Resource.client.add_file(self, file_path, description, convert_to, pingback_url, output_locations)
end

#add_file_from_url(url, description = nil, convert_to = nil, pingback_url = nil) ⇒ Object

Adds a file to the Drop from a given url



55
56
57
# File 'lib/rmb/drop.rb', line 55

def add_file_from_url(url, description = nil, convert_to = nil, pingback_url = nil)
  Rmb::Resource.client.add_file_from_url(self,url,description, convert_to, pingback_url)
end

#assets(page = 1, order = :oldest) ⇒ Object

Gets a list of assets associated with the Drop. Paginated at



8
9
10
# File 'lib/rmb/drop.rb', line 8

def assets(page = 1, order = :oldest)
  Rmb::Resource.client.assets(self, page, order)
end

#change_name(new_name) ⇒ Object

Changes the name of a drop.



30
31
32
# File 'lib/rmb/drop.rb', line 30

def change_name(new_name)
  Rmb::Resource.client.change_drop_name(self,new_name)
end

Creates a link with a url, title, and description.



70
71
72
# File 'lib/rmb/drop.rb', line 70

def create_link(url, title = nil, description = nil)
  Rmb::Resource.client.create_link(self, url, title, description)
end

#create_note(contents, title = nil, description = nil) ⇒ Object

Creates a note with a title and contents



65
66
67
# File 'lib/rmb/drop.rb', line 65

def create_note(contents, title = nil, description = nil)
  Rmb::Resource.client.create_note(self, contents, title, description)
end

#create_pingback_subscription(url, events = {}) ⇒ Object

Creates a subscription to receive POSTs from rmb.io.



75
76
77
# File 'lib/rmb/drop.rb', line 75

def create_pingback_subscription(url, events = {})
  Rmb::Resource.client.create_pingback_subscription(self,url,events)
end

#destroy!Object

Deletes the Drop from the system including all associated assets.



50
51
52
# File 'lib/rmb/drop.rb', line 50

def destroy!
  Rmb::Resource.client.delete_drop(self)
end

#emptyObject

Empties the drop, including it’s assets.



35
36
37
# File 'lib/rmb/drop.rb', line 35

def empty
  Rmb::Resource.client.empty_drop(self)
end

#generate_urlObject

Generates an authenticated URL that will bypass any login action.



85
86
87
# File 'lib/rmb/drop.rb', line 85

def generate_url
  Rmb::Resource.client.generate_drop_url(self)
end

#promote(nick) ⇒ Object

Promotes a nickname in the drop chat to admin.



40
41
42
# File 'lib/rmb/drop.rb', line 40

def promote(nick)
  Rmb::Resource.client.promote_nick(self,nick)
end

#saveObject

Saves the Drop.



45
46
47
# File 'lib/rmb/drop.rb', line 45

def save
  Rmb::Resource.client.update_drop(self)
end

#subscriptions(page = 1) ⇒ Object

Gets a list of Subscription objects.



80
81
82
# File 'lib/rmb/drop.rb', line 80

def subscriptions(page = 1)
  Rmb::Resource.client.subscriptions(self, page)
end