Sha256: 468a2dc1bdad38842f16661e0e40e3a5c9fa9d84c739b207bc309093fd8c7bc8

Contents?: true

Size: 1.29 KB

Versions: 17

Compression:

Stored size: 1.29 KB

Contents

module MyJohnDeere
  class MapLayer < OrganizationOwnedResource
    self.supports_delete = true
    self.base_jd_resource = "mapLayers"
    self.list_resource_path = "mapLayerSummaries/%{map_layer_summary_id}/#{self.base_jd_resource}"
    self.retrieve_resource_path = self.base_jd_resource
    attributes_to_pull_from_json(:id, :title, :extent, :legends)

    def initialize(json_object, access_token = nil)
      super(json_object, access_token)
      self.legends["ranges"].map! { |l| MapLegendItem.new(l) }
    end

    def self.create(access_token, map_layer_summary_id, organization_id,
        title: "", minimum_latitude: 0, maximum_latitude: 0, 
        minimum_longitude: 0, maximum_longitude:0, map_layer_id: "", map_legend_items: [])
      body = {
        links: [
          self.owning_organization_link_item(organization_id)
        ],
        title: title,
        extent: {
          minimumLatitude: minimum_latitude,
          maximumLatitude: maximum_latitude,
          minimumLongitude: minimum_longitude,
          maximumLongitude: maximum_longitude
        },
        legends: {
           unitId: map_layer_id,
           ranges: map_legend_items.map { |mls| mls.to_hash }
        }
      }

      return send_create(access_token, body, {map_layer_summary_id: map_layer_summary_id})
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
myjohndeere-0.1.11 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.10 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.9 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.8 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.7 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.6 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.5 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.4 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.3 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.2 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.1 lib/myjohndeere/map_layer.rb
myjohndeere-0.1.0 lib/myjohndeere/map_layer.rb
myjohndeere-0.0.11 lib/myjohndeere/map_layer.rb
myjohndeere-0.0.10 lib/myjohndeere/map_layer.rb
myjohndeere-0.0.9 lib/myjohndeere/map_layer.rb
myjohndeere-0.0.8 lib/myjohndeere/map_layer.rb
myjohndeere-0.0.7 lib/myjohndeere/map_layer.rb