Sha256: 014f5fdd9839b1fb52d4944b35bc9a9a2bba2a551d81900c678f342014aa308e

Contents?: true

Size: 819 Bytes

Versions: 11

Compression:

Stored size: 819 Bytes

Contents

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

    def initialize(json_object, access_token = nil, field_id = nil)
      super(json_object, access_token)
      self.field_id = field_id
      self.active = self.active.to_s.downcase == "true"
      self.multipolygons = json_object["multipolygons"]
      # This doesn't exist currently, not sure why
      self.field_id ||= extract_link_with_rel_from_list("fields", /\/(\d+)\/(.+?)\/fields\Z/)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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