Class: AppleRepository

Inherits:
Ibrain::BaseRepository
  • Object
show all
Defined in:
app/repositories/apple_repository.rb

Instance Method Summary collapse

Constructor Details

#initialize(record, params) ⇒ AppleRepository

Returns a new instance of AppleRepository.



4
5
6
7
8
9
# File 'app/repositories/apple_repository.rb', line 4

def initialize(record, params)
  super(nil, record)

  @params = params
  @collection = Ibrain.user_class
end

Instance Method Details

#find_or_initialize!Object



11
12
13
14
15
16
# File 'app/repositories/apple_repository.rb', line 11

def find_or_initialize!
  user = @collection.find_by_apple(uid: params['uid'])
  return user if user.present?

  @collection.create_with_line!
end