Class: ShedCloud::PartnerApi::Resources::Orders

Inherits:
Base
  • Object
show all
Defined in:
lib/shedcloud/partner_api/resources/orders.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ShedCloud::PartnerApi::Resources::Base

Instance Method Details

#add_line_item(id, body) ⇒ Object



19
20
21
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 19

def add_line_item(id, body)
  @http.request('POST', "/partner/v1/orders/#{path_segment(id)}/line-items", body: body) || {}
end

#contract(id) ⇒ Object



43
44
45
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 43

def contract(id)
  @http.request('GET', "/partner/v1/orders/#{path_segment(id)}/contract") || {}
end

#create(body, options: nil) ⇒ Object



15
16
17
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 15

def create(body, options: nil)
  @http.request('POST', '/partner/v1/orders', body: body, headers: option_headers(options)) || {}
end

#create_payment(id, body, options: nil) ⇒ Object



51
52
53
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 51

def create_payment(id, body, options: nil)
  @http.request('POST', "/partner/v1/orders/#{path_segment(id)}/payments", body: body, headers: option_headers(options)) || {}
end


55
56
57
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 55

def create_payment_link(id, body)
  @http.request('POST', "/partner/v1/orders/#{path_segment(id)}/payment-links", body: body) || {}
end

#delete_line_item(id, line_id) ⇒ Object



23
24
25
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 23

def delete_line_item(id, line_id)
  @http.request('DELETE', "/partner/v1/orders/#{path_segment(id)}/line-items/#{path_segment(line_id)}")
end

#get(id) ⇒ Object



11
12
13
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 11

def get(id)
  @http.request('GET', "/partner/v1/orders/#{path_segment(id)}") || {}
end

#line_items(id) ⇒ Object



39
40
41
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 39

def line_items(id)
  @http.request('GET', "/partner/v1/orders/#{path_segment(id)}/line-items") || {}
end

#list(params = {}) ⇒ Object



7
8
9
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 7

def list(params = {})
  @http.request('GET', '/partner/v1/orders', query: params) || {}
end

#payments(id, params = {}) ⇒ Object



47
48
49
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 47

def payments(id, params = {})
  @http.request('GET', "/partner/v1/orders/#{path_segment(id)}/payments", query: params) || {}
end

#status_history(id, params = {}) ⇒ Object



35
36
37
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 35

def status_history(id, params = {})
  @http.request('GET', "/partner/v1/orders/#{path_segment(id)}/status-history", query: params) || {}
end

#update(id, body, options: nil) ⇒ Object



27
28
29
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 27

def update(id, body, options: nil)
  @http.request('PATCH', "/partner/v1/orders/#{path_segment(id)}", body: body, headers: option_headers(options)) || {}
end

#update_status(id, body) ⇒ Object



31
32
33
# File 'lib/shedcloud/partner_api/resources/orders.rb', line 31

def update_status(id, body)
  @http.request('POST', "/partner/v1/orders/#{path_segment(id)}/status", body: body) || {}
end