Class: Trello::AssociationFetcher::HasOne::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/trello/association_fetcher/has_one/params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(association_owner:, association_name:, association_options:) ⇒ Params

Returns a new instance of Params.



7
8
9
10
11
# File 'lib/trello/association_fetcher/has_one/params.rb', line 7

def initialize(association_owner:, association_name:, association_options:)
  @association_owner = association_owner
  @association_name = association_name
  @association_options = association_options || {}
end

Instance Attribute Details

#association_ownerObject (readonly)

Returns the value of attribute association_owner.



5
6
7
# File 'lib/trello/association_fetcher/has_one/params.rb', line 5

def association_owner
  @association_owner
end

Instance Method Details

#association_classObject



13
14
15
# File 'lib/trello/association_fetcher/has_one/params.rb', line 13

def association_class
  association_options[:via] || infer_class_on(association_name)
end

#association_restful_idObject



21
22
23
24
# File 'lib/trello/association_fetcher/has_one/params.rb', line 21

def association_restful_id
  id_field = association_options[:using] || :id
  association_owner.send(id_field)
end

#association_restful_nameObject



17
18
19
# File 'lib/trello/association_fetcher/has_one/params.rb', line 17

def association_restful_name
  association_options[:path]
end