Sha256: 387bb6604939f38b12c50437004d736c1fc20531b6c58d96e88ddbb1c612c772

Contents?: true

Size: 940 Bytes

Versions: 12

Compression:

Stored size: 940 Bytes

Contents

module MyJohnDeere
  class Field < OrganizationOwnedResource
    self.base_jd_resource = "fields"
    self.list_resource_path = "organizations/%{organization_id}/#{self.base_jd_resource}"
    self.retrieve_resource_path = "organizations/%{organization_id}/#{self.base_jd_resource}"
    attributes_to_pull_from_json(:id, :name, :boundaries)

    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

    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

    def boundary=(val)
      @boundary = val
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
myjohndeere-0.1.0 lib/myjohndeere/field.rb
myjohndeere-0.0.11 lib/myjohndeere/field.rb
myjohndeere-0.0.10 lib/myjohndeere/field.rb
myjohndeere-0.0.9 lib/myjohndeere/field.rb
myjohndeere-0.0.8 lib/myjohndeere/field.rb
myjohndeere-0.0.7 lib/myjohndeere/field.rb
myjohndeere-0.0.6 lib/myjohndeere/field.rb
myjohndeere-0.0.5 lib/myjohndeere/field.rb
myjohndeere-0.0.4 lib/myjohndeere/field.rb
myjohndeere-0.0.3 lib/myjohndeere/field.rb
myjohndeere-0.0.2 lib/myjohndeere/field.rb
myjohndeere-0.0.1 lib/myjohndeere/field.rb