Sha256: 6f0d838e620202c88cc38292815d8c03520c5ab49aa2c7a4d2d9506487611c69

Contents?: true

Size: 1.23 KB

Versions: 17

Compression:

Stored size: 1.23 KB

Contents

module MyJohnDeere
  class MapLayerSummary < OrganizationOwnedResource
    self.supports_delete = true
    self.base_jd_resource = "mapLayerSummaries"
    self.list_resource_path = "organizations/%{organization_id}/fields/%{field_id}/#{self.base_jd_resource}"
    self.retrieve_resource_path = self.base_jd_resource
    attributes_to_pull_from_json(:id, :title, :text, :metadata, :dateCreated, :lastModifiedDate)

    def initialize(json_object, access_token = nil)
      super(json_object, access_token)
    end

    def self.create(access_token, organization_id, field_id, 
        title, caption, metadata: [], date_created: nil)
      body = {
        title: title,
        text: caption,
        links: [
            owning_organization_link_item(organization_id),
            {
               rel: "contributionDefinition",
               uri: "#{MyJohnDeere.configuration.endpoint}/contributionDefinitions/#{MyJohnDeere.configuration.contribution_definition_id}"
            }
         ],
        metadata: metadata.map { |md| md.to_hash },
        dateCreated: (date_created || Time.now).strftime("%Y-%m-%dT%H:%M:%S.%LZ")
      }
      
      return send_create(access_token, body, {field_id: field_id, organization_id: organization_id})
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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