class MyJohnDeereApi::Model::Organization
Attributes
name[R]
type[R]
Public Instance Methods
assets()
click to toggle source
assets associated with this organization
# File lib/my_john_deere_api/model/organization.rb, line 26 def assets return @assets if defined?(@assets) @assets = MyJohnDeereApi::Request::Collection::Assets.new(client, organization: id) end
connections_uri()
click to toggle source
the URI for JD connections page, if available
# File lib/my_john_deere_api/model/organization.rb, line 41 def connections_uri record['links'].detect{|link| link['rel'] == 'connections'}&.fetch('uri') end
fields()
click to toggle source
fields associated with this organization
# File lib/my_john_deere_api/model/organization.rb, line 18 def fields return @fields if defined?(@fields) @fields = MyJohnDeereApi::Request::Collection::Fields.new(client, organization: id) end
member?()
click to toggle source
Since the member attribute is boolean, we reflect this in the method name instead of using a standard attr_reader.
# File lib/my_john_deere_api/model/organization.rb, line 11 def member? @member end
needs_connection?()
click to toggle source
whether this organization still needs to be approved in JD “connections”
# File lib/my_john_deere_api/model/organization.rb, line 34 def needs_connection? links.key?('connections') end
Private Instance Methods
expected_record_type()
click to toggle source
# File lib/my_john_deere_api/model/organization.rb, line 53 def expected_record_type 'Organization' end
map_attributes(record)
click to toggle source
# File lib/my_john_deere_api/model/organization.rb, line 47 def map_attributes(record) @name = record['name'] @type = record['type'] @member = record['member'] end