Module: Arkenstone::Queryable::ClassMethods
- Defined in:
- lib/arkenstone/queryable.rb
Instance Method Summary collapse
Instance Method Details
#build_where_body(query = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/arkenstone/queryable.rb', line 26 def build_where_body(query = nil, &) if query.instance_of?(String) body = query elsif query.instance_of?(Hash) body = query.to_json elsif query.nil? && block_given? builder = Arkenstone::QueryBuilder.new body = builder.build(&) end end |
#query_url ⇒ Object
12 13 14 |
# File 'lib/arkenstone/queryable.rb', line 12 def query_url "#{full_url(arkenstone_url)}query" end |
#where(query = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/arkenstone/queryable.rb', line 16 def where(query = nil, &) check_for_url body = build_where_body(query, &) return nil if body.nil? # TODO: - refactor the network stuff into it's own module, so that we don't have `self` here response = send_request query_url, :post, body parse_all response.body if Arkenstone::Network.response_is_success response end |