Class: ElectricProfile::RespondentProfiler
- Inherits:
-
Object
- Object
- ElectricProfile::RespondentProfiler
- Defined in:
- lib/electric_profile_ruby/respondent_profiler.rb
Instance Attribute Summary collapse
-
#profiler ⇒ Object
Returns the value of attribute profiler.
-
#questions ⇒ Object
Returns the value of attribute questions.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(atts) ⇒ RespondentProfiler
constructor
A new instance of RespondentProfiler.
- #save ⇒ Object
Constructor Details
#initialize(atts) ⇒ RespondentProfiler
Returns a new instance of RespondentProfiler.
6 7 8 9 10 |
# File 'lib/electric_profile_ruby/respondent_profiler.rb', line 6 def initialize(atts) atts = atts.inject({}){ |memo, (k, v) | memo[k.to_sym] = v; memo } @questions = atts[:questions] @profiler = atts[:profiler] end |
Instance Attribute Details
#profiler ⇒ Object
Returns the value of attribute profiler.
4 5 6 |
# File 'lib/electric_profile_ruby/respondent_profiler.rb', line 4 def profiler @profiler end |
#questions ⇒ Object
Returns the value of attribute questions.
4 5 6 |
# File 'lib/electric_profile_ruby/respondent_profiler.rb', line 4 def questions @questions end |
Class Method Details
.find(profiler_id, user_id, locale) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/electric_profile_ruby/respondent_profiler.rb', line 20 def self.find(profiler_id, user_id, locale) client = Client.new if client.fetch_respondent_profiler(profiler_id, user_id, locale) new client.data else raise StandardError, client.error end end |
Instance Method Details
#save ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/electric_profile_ruby/respondent_profiler.rb', line 12 def save if @id save_existing else save_new end end |