Class: MyJohnDeere::Field
- Inherits:
-
OrganizationOwnedResource
- Object
- Requestable
- SingleResource
- OrganizationOwnedResource
- MyJohnDeere::Field
- Defined in:
- lib/myjohndeere/field.rb
Instance Attribute Summary
Attributes inherited from OrganizationOwnedResource
Attributes inherited from SingleResource
Attributes inherited from Requestable
Instance Method Summary collapse
- #boundary ⇒ Object
- #boundary=(val) ⇒ Object
-
#initialize(json_object, access_token = nil) ⇒ Field
constructor
A new instance of Field.
Methods inherited from OrganizationOwnedResource
Methods included from JSONAttributes
Methods included from RESTMethods
Methods inherited from Requestable
#extract_link_with_rel_from_list, get_created_id_from_response_headers
Constructor Details
#initialize(json_object, access_token = nil) ⇒ Field
Returns a new instance of Field.
8 9 10 11 12 13 14 15 |
# File 'lib/myjohndeere/field.rb', line 8 def initialize(json_object, access_token = nil) super(json_object, access_token) boundaries = json_object["boundaries"] if boundaries && boundaries.length > 0 then # If we embed, then we'll need to pass our id self.boundary = Boundary.new(boundaries[0], access_token, self.id) end end |
Instance Method Details
#boundary ⇒ Object
17 18 19 20 21 22 |
# File 'lib/myjohndeere/field.rb', line 17 def boundary if @boundary.nil? then @boundary = Boundary.retrieve(self.access_token, field_id: self.id, organization_id: self.organization_id) end return @boundary end |
#boundary=(val) ⇒ Object
24 25 26 |
# File 'lib/myjohndeere/field.rb', line 24 def boundary=(val) @boundary = val end |