class Stormpath::Resource::Expansion

Attributes

query[R]

Public Class Methods

new(*names) click to toggle source
   # File lib/stormpath-sdk/resource/expansion.rb
21 def initialize(*names)
22   @query = {}
23   @properties = {}
24 
25   names.each { |name| add_property name }
26 end

Public Instance Methods

add_property(name, options = {}) click to toggle source
   # File lib/stormpath-sdk/resource/expansion.rb
28 def add_property(name, options = {})
29   @properties[name] = if options[:offset] || options[:limit]
30                         pagination = []
31                         pagination.push("offset:#{options[:offset]}") if options[:offset]
32                         pagination.push("limit:#{options[:limit]}") if options[:limit]
33 
34                         "#{name}(#{pagination.join(',')})"
35                       else
36                         name
37                       end
38 end
to_query() click to toggle source
   # File lib/stormpath-sdk/resource/expansion.rb
40 def to_query
41   { expand: @properties.values.join(',') } if @properties.any?
42 end