Class: Rmb::Client
- Inherits:
-
Object
- Object
- Rmb::Client
- Defined in:
- lib/rmb/client.rb
Instance Attribute Summary collapse
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
- #add_file(drop, file_path, description = nil, convert_to = nil, pingback_url = nil, output_locations = nil) ⇒ Object
- #add_file_from_url(drop, url, description = nil, convert_to = nil, pingback_url = nil) ⇒ Object
- #all_drops(page = 1) ⇒ Object
- #asset(drop, asset_name) ⇒ Object
- #assets(drop, page = 1, order = :oldest) ⇒ Object
- #change_asset_name(asset, new_name) ⇒ Object
- #change_drop_name(drop, new_name) ⇒ Object
- #copy_asset(asset, target_drop) ⇒ Object
- #create_drop(params = {}) ⇒ Object
- #create_job(job = {}) ⇒ Object
- #create_link(drop, url, title = nil, description = nil) ⇒ Object
- #create_note(drop, contents, title = nil, description = nil) ⇒ Object
- #create_pingback_subscription(drop, url, events) ⇒ Object
- #delete_asset(asset) ⇒ Object
- #delete_drop(drop) ⇒ Object
- #delete_role(asset, role, location = nil) ⇒ Object
- #delete_subscription(subscription) ⇒ Object
- #drop(drop_name) ⇒ Object
- #drop_upload_code(drop) ⇒ Object
- #empty_drop(drop) ⇒ Object
- #generate_asset_url(asset) ⇒ Object
- #generate_drop_url(drop) ⇒ Object
- #generate_original_file_url(asset) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #job(id, drop_name, asset_name_or_id) ⇒ Object
- #move_asset(asset, target_drop) ⇒ Object
- #promote_nick(drop, nick) ⇒ Object
- #send_asset_to_drop(asset, target_drop) ⇒ Object
- #subscriptions(drop, page = 1) ⇒ Object
- #update_asset(asset) ⇒ Object
- #update_drop(drop) ⇒ Object
Constructor Details
Instance Attribute Details
#service ⇒ Object
Returns the value of attribute service.
2 3 4 |
# File 'lib/rmb/client.rb', line 2 def service @service end |
Instance Method Details
#add_file(drop, file_path, description = nil, convert_to = nil, pingback_url = nil, output_locations = nil) ⇒ Object
70 71 72 73 74 |
# File 'lib/rmb/client.rb', line 70 def add_file(drop, file_path, description = nil, convert_to = nil, pingback_url = nil, output_locations = nil) a = handle(:asset, self.service.add_file(drop.name, file_path, description, convert_to, pingback_url, output_locations)) a.drop = drop a end |
#add_file_from_url(drop, url, description = nil, convert_to = nil, pingback_url = nil) ⇒ Object
76 77 78 79 80 |
# File 'lib/rmb/client.rb', line 76 def add_file_from_url(drop, url, description = nil, convert_to = nil, pingback_url = nil) a = handle(:asset, self.service.add_file_from_url(drop.name, url, description, convert_to, pingback_url)) a.drop = drop a end |
#all_drops(page = 1) ⇒ Object
12 13 14 |
# File 'lib/rmb/client.rb', line 12 def all_drops(page = 1) handle(:drops, self.service.all_drops(page)) end |
#asset(drop, asset_name) ⇒ Object
88 89 90 91 92 |
# File 'lib/rmb/client.rb', line 88 def asset(drop, asset_name) a = handle(:asset, self.service.asset(drop.name,asset_name)) a.drop = drop a end |
#assets(drop, page = 1, order = :oldest) ⇒ Object
82 83 84 85 86 |
# File 'lib/rmb/client.rb', line 82 def assets(drop, page = 1, order = :oldest) assets = handle(:assets, self.service.assets(drop.name,page,order)) assets.each{|a| a.drop = drop} assets end |
#change_asset_name(asset, new_name) ⇒ Object
109 110 111 112 113 |
# File 'lib/rmb/client.rb', line 109 def change_asset_name(asset, new_name) handle(:asset, self.service.change_asset_name(asset.drop.name,asset.name,new_name)) asset.name = new_name asset end |
#change_drop_name(drop, new_name) ⇒ Object
24 25 26 27 28 |
# File 'lib/rmb/client.rb', line 24 def change_drop_name(drop, new_name) handle(:drop, self.service.change_drop_name(drop.name,new_name)) drop.name = new_name drop end |
#copy_asset(asset, target_drop) ⇒ Object
130 131 132 133 |
# File 'lib/rmb/client.rb', line 130 def copy_asset(asset,target_drop) r = handle(:response, self.service.copy_asset(asset.drop.name,asset.name,target_drop.name)) r["result"] end |
#create_drop(params = {}) ⇒ Object
20 21 22 |
# File 'lib/rmb/client.rb', line 20 def create_drop(params = {}) handle(:drop, self.service.create_drop(params)) end |
#create_job(job = {}) ⇒ Object
161 162 163 |
# File 'lib/rmb/client.rb', line 161 def create_job(job = {}) handle(:job, self.service.create_job(job)) end |
#create_link(drop, url, title = nil, description = nil) ⇒ Object
58 59 60 61 62 |
# File 'lib/rmb/client.rb', line 58 def create_link(drop, url, title = nil, description = nil) a = handle(:asset, self.service.create_link(drop.name, url, title, description)) a.drop = drop a end |
#create_note(drop, contents, title = nil, description = nil) ⇒ Object
64 65 66 67 68 |
# File 'lib/rmb/client.rb', line 64 def create_note(drop, contents, title = nil, description = nil) a = handle(:asset, self.service.create_note(drop.name, contents, title, description)) a.drop = drop a end |
#create_pingback_subscription(drop, url, events) ⇒ Object
140 141 142 143 144 |
# File 'lib/rmb/client.rb', line 140 def create_pingback_subscription(drop, url, events) s = handle(:subscription, self.service.create_pingback_subscription(drop.name, url, events)) s.drop = drop s end |
#delete_asset(asset) ⇒ Object
115 116 117 118 |
# File 'lib/rmb/client.rb', line 115 def delete_asset(asset) r = handle(:response, self.service.delete_asset(asset.drop.name, asset.id)) r["result"] end |
#delete_drop(drop) ⇒ Object
43 44 45 46 |
# File 'lib/rmb/client.rb', line 43 def delete_drop(drop) r = handle(:response, self.service.delete_drop(drop.name)) r["result"] end |
#delete_role(asset, role, location = nil) ⇒ Object
120 121 122 123 |
# File 'lib/rmb/client.rb', line 120 def delete_role(asset, role, location=nil) r = handle(:response, self.service.delete_role(asset.drop.name, asset.id, role, location)) r["result"] end |
#delete_subscription(subscription) ⇒ Object
152 153 154 155 |
# File 'lib/rmb/client.rb', line 152 def delete_subscription(subscription) r = handle(:response, self.service.delete_subscription(subscription.drop.name,subscription.id)) r["result"] end |
#drop(drop_name) ⇒ Object
8 9 10 |
# File 'lib/rmb/client.rb', line 8 def drop(drop_name) handle(:drop, self.service.drop(drop_name)) end |
#drop_upload_code(drop) ⇒ Object
53 54 55 56 |
# File 'lib/rmb/client.rb', line 53 def drop_upload_code(drop) r = handle(:response, self.service.drop_upload_code(drop.name)) r["upload_code"] end |
#empty_drop(drop) ⇒ Object
38 39 40 41 |
# File 'lib/rmb/client.rb', line 38 def empty_drop(drop) r = handle(:response, self.service.empty_drop(drop.name)) r["result"] end |
#generate_asset_url(asset) ⇒ Object
94 95 96 |
# File 'lib/rmb/client.rb', line 94 def generate_asset_url(asset) self.service.generate_asset_url(asset.drop.name, asset.name) end |
#generate_drop_url(drop) ⇒ Object
16 17 18 |
# File 'lib/rmb/client.rb', line 16 def generate_drop_url(drop) self.service.generate_drop_url(drop.name) end |
#generate_original_file_url(asset) ⇒ Object
98 99 100 |
# File 'lib/rmb/client.rb', line 98 def generate_original_file_url(asset) self.service.generate_original_file_url(asset.drop.name, asset.name) end |
#job(id, drop_name, asset_name_or_id) ⇒ Object
157 158 159 |
# File 'lib/rmb/client.rb', line 157 def job(id, drop_name, asset_name_or_id) handle(:job, self.service.job(id, drop_name, asset_name_or_id)) end |
#move_asset(asset, target_drop) ⇒ Object
135 136 137 138 |
# File 'lib/rmb/client.rb', line 135 def move_asset(asset,target_drop) r = handle(:response, self.service.move_asset(asset.drop.name,asset.name,target_drop.name)) r["result"] end |
#promote_nick(drop, nick) ⇒ Object
48 49 50 51 |
# File 'lib/rmb/client.rb', line 48 def promote_nick(drop,nick) r = handle(:response, self.service.promote_nick(drop.name,nick)) r["result"] end |
#send_asset_to_drop(asset, target_drop) ⇒ Object
125 126 127 128 |
# File 'lib/rmb/client.rb', line 125 def send_asset_to_drop(asset, target_drop) r = handle(:response, self.service.send_asset_to_drop(asset.drop.name, asset.name, target_drop.name)) r["result"] end |
#subscriptions(drop, page = 1) ⇒ Object
146 147 148 149 150 |
# File 'lib/rmb/client.rb', line 146 def subscriptions(drop, page = 1) subscriptions = handle(:subscriptions, self.service.subscriptions(drop.name, page)) subscriptions.each{|s| s.drop = drop} subscriptions end |
#update_asset(asset) ⇒ Object
102 103 104 105 106 107 |
# File 'lib/rmb/client.rb', line 102 def update_asset(asset) params = { :title => asset.title, :description => asset.description, :url => asset.url, :contents => asset.contents } a = handle(:asset, self.service.update_asset(asset.drop.name,asset.name,params)) a.drop = asset.drop a end |
#update_drop(drop) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/rmb/client.rb', line 30 def update_drop(drop) params = { :description => drop.description, :admin_email => drop.admin_email, :email_key => drop.email_key, :chat_password => drop.chat_password, :expiration_length => drop.expiration_length, :password => drop.password, :admin_password => drop.admin_password } handle(:drop, self.service.update_drop(drop.name,params)) end |