Class: Jet::Client::Returns

Inherits:
Object
  • Object
show all
Defined in:
lib/jet/client/returns.rb

Constant Summary collapse

STATUSES =
{
  created: 'created',
  acknowledged: 'acknowledged',
  refund_customer_without_return: 'refund%20customer%20without%20return',
  completed_by_merchant: 'completed%20by%20merchant',
}

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Returns

Returns a new instance of Returns.



12
13
14
# File 'lib/jet/client/returns.rb', line 12

def initialize(client)
  @client = client
end

Instance Method Details

#complete_return(return_id, body = {}) ⇒ Object



29
30
31
# File 'lib/jet/client/returns.rb', line 29

def complete_return(return_id, body = {})
  @client.rest_put_with_token("/returns/#{return_id}/complete", body)
end

#get_return(return_url) ⇒ Object



21
22
23
# File 'lib/jet/client/returns.rb', line 21

def get_return(return_url)
  @client.rest_get_with_token(return_url)
end

#get_return_by_id(return_id) ⇒ Object



25
26
27
# File 'lib/jet/client/returns.rb', line 25

def get_return_by_id(return_id)
  @client.rest_get_with_token("/returns/state/#{return_id}")
end

#get_returns(status = :created) ⇒ Object



16
17
18
19
# File 'lib/jet/client/returns.rb', line 16

def get_returns(status = :created)
  query_status = STATUSES[status]
  @client.rest_get_with_token("/returns/#{query_status}")
end