Class: Osm::Myscout::ParentLoginHistory
- Inherits:
-
Osm::Model
- Object
- Osm::Model
- Osm::Myscout::ParentLoginHistory
- Defined in:
- lib/osm/myscout.rb
Constant Summary collapse
- SORT_BY =
[:last_name, :first_name, :member_id]
Instance Attribute Summary collapse
-
#first_name ⇒ String
The member’s first name.
-
#last_login ⇒ DateTime
The time and date of the last login.
-
#last_name ⇒ String
The member’s last name.
-
#logins ⇒ Fixnum
The total number of logins.
-
#member_id ⇒ Fixnum
The id for the member.
Class Method Summary collapse
-
.get_for_section(api, section, options = {}) ⇒ Array<Osm::Myscout::ParentLoginHistory>
Get parent login history.
Instance Method Summary collapse
-
#initialize ⇒ Object
constructor
Initialize a new Member.
Methods inherited from Osm::Model
#<, #<=, #<=>, #>, #>=, #between?, #changed_attributes, configure, #reset_changed_attributes, #to_i
Constructor Details
#initialize ⇒ Object
Initialize a new Member
|
# File 'lib/osm/myscout.rb', line 35
|
Instance Attribute Details
#first_name ⇒ String
Returns the member’s first name.
19 |
# File 'lib/osm/myscout.rb', line 19 attribute :member_id, type: Integer |
#last_login ⇒ DateTime
Returns the time and date of the last login.
19 |
# File 'lib/osm/myscout.rb', line 19 attribute :member_id, type: Integer |
#last_name ⇒ String
Returns the member’s last name.
19 |
# File 'lib/osm/myscout.rb', line 19 attribute :member_id, type: Integer |
#logins ⇒ Fixnum
Returns the total number of logins.
19 |
# File 'lib/osm/myscout.rb', line 19 attribute :member_id, type: Integer |
#member_id ⇒ Fixnum
Returns the id for the member.
19 |
# File 'lib/osm/myscout.rb', line 19 attribute :member_id, type: Integer |
Class Method Details
.get_for_section(api, section, options = {}) ⇒ Array<Osm::Myscout::ParentLoginHistory>
Get parent login history
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/osm/myscout.rb', line 45 def self.get_for_section(api, section, ={}) section_id = section.to_i require_ability_to(api, :read, :member, section, ) cache_key = ['myscout', 'parent_login_history', section_id] if ![:no_cache] && cache_exist?(api, cache_key) return cache_read(api, cache_key) end data = api.perform_query("ext/settings/parents/loginhistory/?action=getLoginHistory§ionid=#{section_id}") return [] unless data.is_a?(Hash) data = data['items'] return [] unless data.is_a?(Array) data.map! do |item| new( member_id: Osm::to_i_or_nil(item['scoutid']), first_name: item['firstname'], last_name: item['lastname'], logins: Osm::to_i_or_nil(item['numlogins']), last_login: get_last_login_date(item['lastlogin'],) ) end cache_write(api, cache_key, data) return data end |