Class: MyJohnDeereApi::Model::Organization
- Defined in:
- lib/my_john_deere_api/model/organization.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Base
#client, #id, #links, #record, #record_type
Instance Method Summary collapse
-
#assets ⇒ Object
assets associated with this organization.
-
#connections_uri ⇒ Object
the URI for JD connections page, if available.
-
#fields ⇒ Object
fields associated with this organization.
-
#member? ⇒ Boolean
Since the member attribute is boolean, we reflect this in the method name instead of using a standard attr_reader.
-
#needs_connection? ⇒ Boolean
whether this organization still needs to be approved in JD “connections”.
Methods inherited from Base
Constructor Details
This class inherits a constructor from MyJohnDeereApi::Model::Base
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/my_john_deere_api/model/organization.rb', line 5 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/my_john_deere_api/model/organization.rb', line 5 def type @type end |
Instance Method Details
#assets ⇒ Object
assets associated with this organization
26 27 28 29 |
# 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 ⇒ Object
the URI for JD connections page, if available
41 42 43 |
# 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 ⇒ Object
fields associated with this organization
18 19 20 21 |
# 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? ⇒ Boolean
Since the member attribute is boolean, we reflect this in the method name instead of using a standard attr_reader.
11 12 13 |
# File 'lib/my_john_deere_api/model/organization.rb', line 11 def member? @member end |
#needs_connection? ⇒ Boolean
whether this organization still needs to be approved in JD “connections”
34 35 36 |
# File 'lib/my_john_deere_api/model/organization.rb', line 34 def needs_connection? links.key?('connections') end |