Class: MyJohnDeere::MapLayer
- Inherits:
-
OrganizationOwnedResource
- Object
- Requestable
- SingleResource
- OrganizationOwnedResource
- MyJohnDeere::MapLayer
- Defined in:
- lib/myjohndeere/map_layer.rb
Instance Attribute Summary
Attributes inherited from OrganizationOwnedResource
Attributes inherited from SingleResource
Attributes inherited from Requestable
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json_object, access_token = nil) ⇒ MapLayer
constructor
A new instance of MapLayer.
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) ⇒ MapLayer
Returns a new instance of MapLayer.
8 9 10 11 |
# File 'lib/myjohndeere/map_layer.rb', line 8 def initialize(json_object, access_token = nil) super(json_object, access_token) self.legends["ranges"].map! { |l| MapLegendItem.new(l) } end |
Class Method Details
.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: []) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/myjohndeere/map_layer.rb', line 13 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 |