Module: MediaMonsterClient
- Defined in:
- lib/media_monster_client.rb,
lib/media_monster_client/version.rb
Constant Summary collapse
- VERSION =
"2.0.7"
Class Attribute Summary collapse
-
.host ⇒ Object
Returns the value of attribute host.
-
.key ⇒ Object
Returns the value of attribute key.
-
.port ⇒ Object
Returns the value of attribute port.
-
.scheme ⇒ Object
Returns the value of attribute scheme.
-
.secret ⇒ Object
Returns the value of attribute secret.
-
.version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
- .create_job(job = nil) {|job| ... } ⇒ Object
- .retry_job(job) ⇒ Object
- .update_job(job) ⇒ Object
- .update_task(task_id, task_status) ⇒ Object
Class Attribute Details
.host ⇒ Object
Returns the value of attribute host.
23 24 25 |
# File 'lib/media_monster_client.rb', line 23 def host @host end |
.key ⇒ Object
Returns the value of attribute key.
23 24 25 |
# File 'lib/media_monster_client.rb', line 23 def key @key end |
.port ⇒ Object
Returns the value of attribute port.
23 24 25 |
# File 'lib/media_monster_client.rb', line 23 def port @port end |
.scheme ⇒ Object
Returns the value of attribute scheme.
23 24 25 |
# File 'lib/media_monster_client.rb', line 23 def scheme @scheme end |
.secret ⇒ Object
Returns the value of attribute secret.
23 24 25 |
# File 'lib/media_monster_client.rb', line 23 def secret @secret end |
.version ⇒ Object
Returns the value of attribute version.
23 24 25 |
# File 'lib/media_monster_client.rb', line 23 def version @version end |
Class Method Details
.create_job(job = nil) {|job| ... } ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/media_monster_client.rb', line 25 def create_job(job=nil) job ||= MediaMonster::Job.new yield job if block_given? job.tap do |j| j_str = post(api_url('jobs'), j.to_json, {'Accept'=>'application/json','Content-Type'=>'application/json'}).body json = JSON.parse(j_str) j.id = json['job']['id'] end end |
.retry_job(job) ⇒ Object
41 42 43 44 45 |
# File 'lib/media_monster_client.rb', line 41 def retry_job(job) to_model(MediaMonster::Job, job).tap do |j| put("#{model_url(j)}/retry", {}, {'Accept'=>'application/json'}) end end |
.update_job(job) ⇒ Object
35 36 37 38 39 |
# File 'lib/media_monster_client.rb', line 35 def update_job(job) to_model(MediaMonster::Job, job).tap do |j| put(model_url(j), j.to_json, {'Accept'=>'application/json','Content-Type'=>'application/json'}) end end |
.update_task(task_id, task_status) ⇒ Object
47 48 49 50 |
# File 'lib/media_monster_client.rb', line 47 def update_task(task_id, task_status) json = {'task'=>{'status'=>task_status}}.to_json put(api_url("tasks/#{task_id.to_i}"), json, {'Accept'=>'application/json', 'Content-Type'=>'application/json'}) end |