Class: MyJohnDeere::Field

Inherits:
OrganizationOwnedResource show all
Defined in:
lib/myjohndeere/field.rb

Instance Attribute Summary

Attributes inherited from OrganizationOwnedResource

#organization_id

Attributes inherited from SingleResource

#deleted

Attributes inherited from Requestable

#access_token, #links

Instance Method Summary collapse

Methods inherited from OrganizationOwnedResource

owning_organization_link_item

Methods included from JSONAttributes

included

Methods included from RESTMethods

included

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

#boundaryObject



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