Class: Odesk::Api::Routers::Mc

Inherits:
Object
  • Object
show all
Defined in:
lib/odesk/api/routers/mc.rb

Constant Summary collapse

ENTRY_POINT =
'api'

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Mc

Init

Arguments:

client: (Client)


24
25
26
27
# File 'lib/odesk/api/routers/mc.rb', line 24

def initialize(client)
  @client = client
  @client.epoint = ENTRY_POINT 
end

Instance Method Details

#get_thread_by_context(username, job_key, application_id, context = 'Interviews') ⇒ Object

Get a specific thread by context

Arguments:

username: (String)
job_key: (String)
application_id: (String)
context: (String)


62
63
64
65
# File 'lib/odesk/api/routers/mc.rb', line 62

def get_thread_by_context(username, job_key, application_id, context = 'Interviews')
  $LOG.i "running " + __method__.to_s
  @client.get '/mc/v1/contexts/' + username + '/' + context + ':' + job_key + ':' + application_id
end

#get_thread_by_context_last_posts(username, job_key, application_id, context = 'Interviews') ⇒ Object

Get a specific thread by context (last message content)

Arguments:

username: (String)
job_key: (String)
application_id: (String)
context: (String)


74
75
76
77
# File 'lib/odesk/api/routers/mc.rb', line 74

def get_thread_by_context_last_posts(username, job_key, application_id, context = 'Interviews')
  $LOG.i "running " + __method__.to_s
  @client.get '/mc/v1/contexts/' + username + '/' + context + ':' + job_key + ':' + application_id + '/last_posts'
end

#get_thread_details(username, thread_id) ⇒ Object

List thread details based on thread id

Arguments:

username: (String)
thread_id: (String)


50
51
52
53
# File 'lib/odesk/api/routers/mc.rb', line 50

def get_thread_details(username, thread_id)
  $LOG.i "running " + __method__.to_s
  @client.get '/mc/v1/threads/' + username + '/' + thread_id
end

#get_tray_by_type(username, type) ⇒ Object

Get tray by type

Arguments:

username: (String)
type: (String)


40
41
42
43
# File 'lib/odesk/api/routers/mc.rb', line 40

def get_tray_by_type(username, type)
  $LOG.i "running " + __method__.to_s
  @client.get '/mc/v1/trays/' + username + '/' + type
end

#get_traysObject

Get trays



30
31
32
33
# File 'lib/odesk/api/routers/mc.rb', line 30

def get_trays
  $LOG.i "running " + __method__.to_s
  @client.get '/mc/v1/trays'
end

#mark_thread(username, thread_id, params = {}) ⇒ Object

Update threads based on user actions

Arguments:

username: (String)
thread_id: (String)
params: (Hash)


106
107
108
109
# File 'lib/odesk/api/routers/mc.rb', line 106

def mark_thread(username, thread_id, params = {})
  $LOG.i "running " + __method__.to_s
  @client.put '/mc/v1/threads/' + username + '/' + thread_id, params
end

#reply_to_thread(username, thread_id, params = {}) ⇒ Object

Reply to existent thread

Arguments:

username: (String)
thread_id: (String)
params: (Hash)


95
96
97
98
# File 'lib/odesk/api/routers/mc.rb', line 95

def reply_to_thread(username, thread_id, params = {})
  $LOG.i "running " + __method__.to_s
  @client.post '/mc/v1/threads/' + username + '/' + thread_id, params
end

#start_new_thread(username, params = {}) ⇒ Object

Send new message

Arguments:

username: (String)
params: (Hash)


84
85
86
87
# File 'lib/odesk/api/routers/mc.rb', line 84

def start_new_thread(username, params = {})
  $LOG.i "running " + __method__.to_s
  @client.post '/mc/v1/threads/' + username, params
end