lib/tsubaiso_sdk.rb in tsubaiso-sdk-1.2.0 vs lib/tsubaiso_sdk.rb in tsubaiso-sdk-1.2.1
- old
+ new
@@ -162,10 +162,17 @@
params = { "format" => "json" }
uri = URI.parse(@base_url + "/ar_reason_masters/list/")
api_request(uri, "GET", params)
end
+ # Alpha version now.
+ def list_fixed_assets
+ params = { "format" => "json" }
+ uri = URI.parse(@base_url + "/fixed_assets/list/")
+ api_request(uri, "GET", params)
+ end
+
def show_sale(voucher)
sale_id = voucher.scan(/\d/).join("")
params = { "format" => "json" }
uri = URI.parse(@base_url + "/ar/show/#{sale_id}")
api_request(uri, "GET", params)
@@ -436,15 +443,15 @@
"finish_date" => options[:finish_date],
"account_codes" => options[:account_codes],
"dept_code" => options[:dept_code],
"tag_list" => options[:tag_list]
},
+ "title" => options[:title],
"target_timestamp" => options[:target_timestamp],
"memo" => options[:memo],
"criteria" => options[:criteria],
- "distribution_conditions" => options[:distribution_conditions],
- "title" => options[:title]
+ "distribution_conditions" => options[:distribution_conditions]
}
uri = URI.parse(@base_url + '/journal_distributions/create/')
api_request(uri, "POST", params)
end
@@ -622,10 +629,17 @@
params = { "format" => "json" }
uri = URI.parse(@base_url + "/journal_distributions/destroy/#{journal_distribution_id}")
api_request(uri, "POST", params)
end
+ # Alpha version now.
+ def destroy_fixed_asset(fixed_asset_id)
+ params = { "format" => "json" }
+ uri = URI.parse(@base_url + "/fixed_assets/destroy/#{fixed_asset_id}")
+ api_request(uri, "POST", params)
+ end
+
private
def api_request(uri, http_verb, params)
http = Net::HTTP.new(uri.host, uri.port)
initheader = {'Content-Type' => 'application/json'}
@@ -640,13 +654,13 @@
response = http.request(request)
if response.body
begin
{:status => response.code, :json => recursive_symbolize_keys(JSON.load(response.body))}
rescue
- {:status => response.code, :body => response.body}
+ response.body
end
else
- {:status => response.code}
+ response.code
end
end
def recursive_symbolize_keys(data)
case data