Sha256: 09f142c72f093be69984884cd567d36e972558bb15b37730fd372181e62ffa2b

Contents?: true

Size: 835 Bytes

Versions: 7

Compression:

Stored size: 835 Bytes

Contents

module MeducationSDK
  class User < Loquor::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",
      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
    }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
meducation_sdk-1.1.0 lib/meducation_sdk/resources/user.rb
meducation_sdk-1.0.0 lib/meducation_sdk/resources/user.rb
meducation_sdk-0.10.1 lib/meducation_sdk/resources/user.rb
meducation_sdk-0.10.0 lib/meducation_sdk/resources/user.rb
meducation_sdk-0.9.0 lib/meducation_sdk/resources/user.rb
meducation_sdk-0.8.0 lib/meducation_sdk/resources/user.rb
meducation_sdk-0.7.0 lib/meducation_sdk/resources/user.rb