Sha256: fe007c4b8b7fbe653d8c4e9d22e6d408b8e48b090f8878034c49b1f923b5d111

Contents?: true

Size: 929 Bytes

Versions: 25

Compression:

Stored size: 929 Bytes

Contents

module MeducationSDK
  class User < Resource
    self.path = "/users"

    def community_memberships
      CommunityMembership.where(user_id: 1)
    end

    def communities
      community_membership_ids = community_memberships.map(&:id)
      return [] if community_membership_ids.empty?
      Community.where(id: community_membership_ids)
    end

    def settings
      UserSettings.where(user_id: id).first
    end
  end

  class UserMock < User
    extend Loquor::ResourceMock

    self.attributes = {
      id: 1,
      first_name: "Jeremy",
      surname: "Walker",
      name: "Jeremy Walker",
      short_display_name: "Jeremy",
      photo_url: "http://i.telegraph.co.uk/multimedia/archive/02351/cross-eyed-cat_2351472k.jpg",
      primary_email_address: "jez.walker@gmail.com",
      url_code: "asd1234567",
      is_site_admin: false,
      views_in_last_30_days: 30,
      views_in_last_60_days: 60
    }
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
meducation_sdk-2.0.1 lib/meducation_sdk/resources/user.rb
meducation_sdk-2.0.0 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.16 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.15 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.14 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.13 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.12 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.11 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.10 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.6 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.5 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.4 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.3 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.2 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.1 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.6.0 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.5.7 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.5.6 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.5.5 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.5.4 lib/meducation_sdk/resources/user.rb