Class: WCC::Arena::ProfileQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/wcc/arena/profile_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ ProfileQuery

Returns a new instance of ProfileQuery.



7
8
9
10
11
12
13
14
15
# File 'lib/wcc/arena/profile_query.rb', line 7

def initialize(args={})
  @session = args.fetch(:session) { WCC::Arena.config.session }
  @profile_type_id = args[:profile_type_id]
  @parent_profile_id = args[:parent_profile_id]
  if profile_type_id && parent_profile_id || !profile_type_id && !parent_profile_id
    raise ArgumentError,
      "Either `profile_type_id' or `parent_profile_id' must be provided but not both"
  end
end

Instance Attribute Details

#parent_profile_idObject (readonly)

Returns the value of attribute parent_profile_id.



5
6
7
# File 'lib/wcc/arena/profile_query.rb', line 5

def parent_profile_id
  @parent_profile_id
end

#profile_type_idObject (readonly)

Returns the value of attribute profile_type_id.



5
6
7
# File 'lib/wcc/arena/profile_query.rb', line 5

def profile_type_id
  @profile_type_id
end

#sessionObject (readonly)

Returns the value of attribute session.



4
5
6
# File 'lib/wcc/arena/profile_query.rb', line 4

def session
  @session
end

Instance Method Details

#callObject



17
18
19
20
21
# File 'lib/wcc/arena/profile_query.rb', line 17

def call
  response_profiles_xml.collect do |profile_xml|
    Profile.new(profile_xml)
  end
end