Class: FlexOps::Resources::Returns

Inherits:
Object
  • Object
show all
Defined in:
lib/flexops/resources/returns.rb

Instance Method Summary collapse

Constructor Details

#initialize(http, ws_id_proc) ⇒ Returns

Returns a new instance of Returns.



12
13
14
15
# File 'lib/flexops/resources/returns.rb', line 12

def initialize(http, ws_id_proc)
  @http = http
  @ws_id = ws_id_proc
end

Instance Method Details

#approve(return_id) ⇒ Object



30
31
32
# File 'lib/flexops/resources/returns.rb', line 30

def approve(return_id)
  @http.post("#{ws_path}/returns/#{return_id}/approve")
end

#cancel(return_id) ⇒ Object



38
39
40
# File 'lib/flexops/resources/returns.rb', line 38

def cancel(return_id)
  @http.post("#{ws_path}/returns/#{return_id}/cancel")
end

#create(request) ⇒ Object



26
27
28
# File 'lib/flexops/resources/returns.rb', line 26

def create(request)
  @http.post("#{ws_path}/returns", body: request)
end

#generate_label(return_id) ⇒ Object



42
43
44
# File 'lib/flexops/resources/returns.rb', line 42

def generate_label(return_id)
  @http.post("#{ws_path}/returns/#{return_id}/label")
end

#get(return_id) ⇒ Object



22
23
24
# File 'lib/flexops/resources/returns.rb', line 22

def get(return_id)
  @http.get("#{ws_path}/returns/#{return_id}")
end

#list(page: nil, page_size: nil, status: nil) ⇒ Object



17
18
19
20
# File 'lib/flexops/resources/returns.rb', line 17

def list(page: nil, page_size: nil, status: nil)
  query = { page: page, pageSize: page_size, status: status }.compact
  @http.get("#{ws_path}/returns", query: query.empty? ? nil : query)
end

#mark_received(return_id, items) ⇒ Object



46
47
48
# File 'lib/flexops/resources/returns.rb', line 46

def mark_received(return_id, items)
  @http.post("#{ws_path}/returns/#{return_id}/receive", body: { items: items })
end

#process_refund(return_id) ⇒ Object



50
51
52
# File 'lib/flexops/resources/returns.rb', line 50

def process_refund(return_id)
  @http.post("#{ws_path}/returns/#{return_id}/refund")
end

#reject(return_id, reason) ⇒ Object



34
35
36
# File 'lib/flexops/resources/returns.rb', line 34

def reject(return_id, reason)
  @http.post("#{ws_path}/returns/#{return_id}/reject", body: { reason: reason })
end