class Phraseapp::Rest::Parameter::Base
Attributes
branch[RW]
order[R]
sort[RW]
Public Class Methods
new(branch: nil, sort: nil, order: nil)
click to toggle source
# File lib/phraseapp-rest/parameter/base.rb, line 10 def initialize(branch: nil, sort: nil, order: nil) @branch = branch unless branch.nil? @sort = sort unless sort.nil? self.order = order unless order.nil? end
Public Instance Methods
order=(str)
click to toggle source
# File lib/phraseapp-rest/parameter/base.rb, line 16 def order=(str) message = "'#{str}' is not supported. Please use 'asc' or 'desc'" raise message unless %w(asc desc).include?(str) @order = str end
to_s()
click to toggle source
# File lib/phraseapp-rest/parameter/base.rb, line 23 def to_s hash = {} params.each do |attr| hash[attr.to_sym] = send(attr) unless send(attr).nil? end hash.to_a.map { |x| "#{x[0]}=#{x[1]}" }.join('&').to_s end
Protected Instance Methods
params()
click to toggle source
# File lib/phraseapp-rest/parameter/base.rb, line 33 def params %w(branch sort order) end