class Prices
Public Class Methods
new(api_key)
click to toggle source
Calls superclass method
Api::new
# File lib/prices.rb, line 4 def initialize(api_key) super(api_key) end
Public Instance Methods
calculate(amount: nil, vat_included: false, category: nil, country_code: nil, country_name: nil, ip_address: nil, use_client_ip: nil)
click to toggle source
# File lib/prices.rb, line 29 def calculate(amount: nil, vat_included: false, category: nil, country_code: nil, country_name: nil, ip_address: nil, use_client_ip: nil) raise "amount is required" if !amount self.api_get('price', { 'amount' => amount, 'vat_included' => vat_included, 'category' => category, 'country_code' => country_code, 'country_name' => country_name, 'ip_address' => ip_address, 'use_client_ip' => use_client_ip, }) end
create_price_calculation(amount: nil, vat_included: false, category: nil, country_code: nil, country_name: nil, ip_address: nil, use_client_ip: nil)
click to toggle source
# File lib/prices.rb, line 15 def create_price_calculation(amount: nil, vat_included: false, category: nil, country_code: nil, country_name: nil, ip_address: nil, use_client_ip: nil) raise "amount is required" if !amount self.api_post('prices', {}, { 'amount' => amount, 'vat_included' => vat_included, 'category' => category, 'country_code' => country_code, 'country_name' => country_name, 'ip_address' => ip_address, 'use_client_ip' => use_client_ip, }) end
get_calculation_by_id(id)
click to toggle source
# File lib/prices.rb, line 43 def get_calculation_by_id(id) self.api_get('prices/' + id) end
get_prices(limit: 100, page: 1)
click to toggle source
# File lib/prices.rb, line 8 def get_prices(limit: 100, page: 1) self.api_get('prices', { 'limit' => limit, 'page' => page, }) end