Module: XeroMin::Urls
- Included in:
- Client
- Defined in:
- lib/xero-min/urls.rb
Instance Method Summary collapse
-
#url_for(sym_or_hash) ⇒ Object
Public : use plural to get a collection or use singular and value url_for(:invoices) OR url_for(invoice: ‘INV-001’).
Instance Method Details
#url_for(sym_or_hash) ⇒ Object
Public : use plural to get a collection or use singular and value url_for(:invoices) OR url_for(invoice: ‘INV-001’)
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/xero-min/urls.rb', line 5 def url_for(sym_or_hash) key, value = case sym_or_hash when Hash sym_or_hash.first else sym_or_hash end base = "https://api.xero.com/api.xro/2.0/#{key.to_s.capitalize}" value ? "#{base}s/#{value}" : base end |