Sha256: acd07762bff77ecd961495a3d7d1f8654c1e9c5678a0f0bb49fa8b745669be5e

Contents?: true

Size: 1.57 KB

Versions: 21

Compression:

Stored size: 1.57 KB

Contents

module FinApps
  module REST
    module Inventory

      require 'erb'

      class FeedCategories < FinApps::REST::Resources

        def list(feed_name, region = nil, city = nil)
          logger.debug "##{__method__.to_s} => Started"

          raise MissingArgumentsError.new 'Missing argument: feed_name.' if feed_name.blank?
          logger.debug "##{__method__.to_s} => feed_name: #{feed_name}"

          raise MissingArgumentsError.new 'Missing argument: region.' if region.blank? && city.present?
          logger.debug "##{__method__.to_s} => region: #{region}"

          raise MissingArgumentsError.new 'Missing argument: city.' if region.present? && city.blank?
          logger.debug "##{__method__.to_s} => city: #{city}"

          if region.present? && city.present?
            end_point = Defaults::END_POINTS[:inventory_feed_categories_list_by_region]
            path = end_point.sub ':feed_name', ERB::Util.url_encode(feed_name)
            path = path.sub ':region', ERB::Util.url_encode(region)
            path = path.sub ':city', ERB::Util.url_encode(city)
          else
            end_point = Defaults::END_POINTS[:inventory_feed_categories_list]
            path = end_point.sub ':feed_name', ERB::Util.url_encode(feed_name)
          end
          logger.debug "##{__method__.to_s} => end_point: #{end_point}"
          logger.debug "##{__method__.to_s} => path: #{path}"

          results, error_messages = @client.send(path, :get)

          logger.debug "##{__method__.to_s} => Completed"
          return results, error_messages
        end

      end

    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
finapps-0.11.0.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.10.1.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.10.0.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.9.0.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.8.5.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.8.4.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.8.3.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.8.2.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.8.1.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.8.0.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.7.4.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.7.3.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.7.2.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.7.1.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.7.0.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.6.0.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.5.4.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.5.3.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.5.2.pre lib/finapps/rest/inventory/feed_categories.rb
finapps-0.5.1.pre lib/finapps/rest/inventory/feed_categories.rb