Module: Mercadolibre::Core::Projects

Included in:
Api
Defined in:
lib/mercadolibre/core/projects.rb

Instance Method Summary collapse

Instance Method Details

#add_application_to_project(application_id, project_id) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/mercadolibre/core/projects.rb', line 28

def add_application_to_project(application_id, project_id)
  payload = { application_id: application_id }.to_json

  headers = { content_type: :json }

  post_request("/projects/#{project_id}/applications?access_token=#{@access_token}",
    payload, headers).body
end

#create_user_project(attrs) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/mercadolibre/core/projects.rb', line 8

def create_user_project(attrs)
  payload = attrs.to_json

  headers = { content_type: :json }

  post_request("/projects?access_token=#{@access_token}", payload, headers).body
end

#delete_user_project(project_id) ⇒ Object



24
25
26
# File 'lib/mercadolibre/core/projects.rb', line 24

def delete_user_project(project_id)
  delete_request("/projects/#{project_id}?access_token=#{@access_token}").body
end

#get_user_project(project_id) ⇒ Object



4
5
6
# File 'lib/mercadolibre/core/projects.rb', line 4

def get_user_project(project_id)
  get_request("/projects/#{project_id}", { access_token: @access_token }).body
end

#remove_application_from_project(application_id, project_id) ⇒ Object



37
38
39
# File 'lib/mercadolibre/core/projects.rb', line 37

def remove_application_from_project(application_id, project_id)
  delete_request("/projects/#{project_id}/applications/#{application_id}?access_token=#{@access_token}").body
end

#update_user_project(project_id, attrs) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/mercadolibre/core/projects.rb', line 16

def update_user_project(project_id, attrs)
  payload = attrs.to_json

  headers = { content_type: :json }

  put_request("/projects/#{project_id}?access_token=#{@access_token}", payload, headers).body
end