class SageoneSdk::SDataResponse

SData response

Attributes

data[R]

Public Class Methods

new(data = {}) click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 6
def initialize(data = {})
  @data = data
end

Public Instance Methods

error?() click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 26
def error?
  false
end
find_by(conditions) click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 30
def find_by(conditions)
  resources.detect do |resource|
    @skip = false
    conditions.each do |field, value|
      unless resource.public_send(field) == value
        @skip = true
        break
      end
    end

    !@skip
  end
end
items_per_page() click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 18
def items_per_page
  @data["$itemsPerPage"]
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/sageone_sdk/sdata_response.rb, line 48
def method_missing(method, *args, &block)
  if resources.respond_to?(method)
    resources.send(method, *args)
  elsif data.respond_to?(method)
    data.send(method, *args)
  else
    super
  end
end
resources() click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 22
def resources
  @data["$resources"]
end
respond_to_missing?(method, include_private = false) click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 44
def respond_to_missing?(method, include_private =  false)
  resources.respond_to?(method, include_private) || data.respond_to?(method, include_private)
end
start_index() click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 14
def start_index
  @data["startIndex"]
end
total_results() click to toggle source
# File lib/sageone_sdk/sdata_response.rb, line 10
def total_results
  @data["$totalResults"]
end