Sha256: 9e3adba4888d9ba987b040caff78e35aaa26220a6f8647ecf262d9e5e5a2fac2

Contents?: true

Size: 787 Bytes

Versions: 4

Compression:

Stored size: 787 Bytes

Contents

require 'caseblocks_api'
require 'active_support/inflector'

module CaseblocksAPI
  class Finder
    def initialize(client)
      @client = client
    end

    def execute_single(case_type, property_name, value)
      @client.get("/case_blocks/#{case_type}", {query: {search: true, property: property_name, value: value}})
    end

    def execute_multiple(case_type, properties)
      @client.get("/case_blocks/#{case_type}", {query: {search: true, properties: properties}})
    end
  end

  class Client
    def find_by_property(case_type, property_name, value)
      Finder.new(self.class).execute_single(case_type, property_name, value)
    end

    def find_by_properties(case_type, properties)
      Finder.new(self.class).execute_multiple(case_type, properties)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
caseblocks_api-0.2.6 lib/caseblocks_api/finder.rb
caseblocks_api-0.2.5 lib/caseblocks_api/finder.rb
caseblocks_api-0.2.4 lib/caseblocks_api/finder.rb
caseblocks_api-0.2.3 lib/caseblocks_api/finder.rb