Sha256: 0ffa6be61a9346a9dee56b404436bceaaa705b85806651675f62735d45d0113f
Contents?: true
Size: 1.82 KB
Versions: 21
Compression:
Stored size: 1.82 KB
Contents
module FinApps module REST require 'erb' class Institutions < FinApps::REST::Resources include FinApps::REST::Defaults # @param [String] term # @return [Array<FinApps::REST::Institution>, Array<String>] def search(term) logger.debug "##{__method__.to_s} => Started" raise MissingArgumentsError.new 'Missing argument: term.' if term.blank? logger.debug "##{__method__.to_s} => term: #{term}" end_point = Defaults::END_POINTS[:institutions_search] logger.debug "##{__method__.to_s} => end_point: #{end_point}" path = end_point.sub ':search_term', ERB::Util.url_encode(term) logger.debug "##{__method__.to_s} => path: #{path}" institutions, error_messages = @client.send(path, :get) do |r| r.body.each { |i| Institution.new(i) } end logger.debug "##{__method__.to_s} => Completed" return institutions, error_messages end # @param [Integer] site_id def form(site_id) logger.debug "##{__method__.to_s} => Started" raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank? logger.debug "##{__method__.to_s} => site_id: #{site_id}" end_point = Defaults::END_POINTS[:institutions_form] logger.debug "##{__method__.to_s} => end_point: #{end_point}" path = end_point.sub ':site_id', ERB::Util.url_encode(site_id) logger.debug "##{__method__.to_s} => path: #{path}" institution, error_messages = @client.send(path, :get) { |r| Institution.new(r.body) } logger.debug "##{__method__.to_s} => Completed" return institution, error_messages end end class Institution < FinApps::REST::Resource attr_accessor :base_url, :display_name, :site_id, :org_display_name, :login_form_html end end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
finapps-0.1.13.pre | lib/finapps/rest/institutions.rb |