Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/@fleetbase/sdk.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/@fleetbase/sdk.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cjs/fleetbase.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cjs/fleetbase.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/fleetbase.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/fleetbase.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/fleetbase.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Store from './store';
import Resource from './resource';
import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';
import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } from './resources';
import { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';
import { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';
import { pluralize, singularize, classify, dasherize, camelize } from './utils/string';
import { extendStoreActions } from './store';
import { orderActions } from './resources/order';
import { driverActions } from './resources/driver';
import { organizationActions } from './resources/organization';

/**
* // instance
Expand Down Expand Up @@ -66,6 +67,7 @@ export default class Fleetbase {
this.vehicles = new Store('vehicle', this.adapter);
this.vendors = new Store('vendor', this.adapter);
this.contacts = new Store('contact', this.adapter);
this.organizations = new Store('organization', this.adapter).extendActions(organizationActions);
}

static newInstance() {
Expand Down Expand Up @@ -98,6 +100,7 @@ export {
ServiceArea,
ServiceRate,
ServiceQuote,
Organization,
BrowserAdapter,
NodeAdapter,
EmberJsAdapter,
Expand Down
3 changes: 2 additions & 1 deletion src/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import TrackingStatus from './resources/tracking-status';
import Vehicle from './resources/vehicle';
import Driver from './resources/driver';
import Vendor from './resources/vendor';
import Organization from './resources/organization';
import Contact from './resources/contact';
import Zone from './resources/zone';
import ServiceArea from './resources/service-area';
import ServiceRate from './resources/service-rate';
import ServiceQuote from './resources/service-quote';

export { Order, Payload, Entity, Place, Waypoint, TrackingStatus, Vehicle, Driver, Vendor, Contact, Zone, ServiceArea, ServiceRate, ServiceQuote };
export { Order, Payload, Entity, Place, Waypoint, TrackingStatus, Vehicle, Organization, Driver, Vendor, Contact, Zone, ServiceArea, ServiceRate, ServiceQuote };
17 changes: 17 additions & 0 deletions src/resources/organization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Resource from '../resource';
import { StoreActions } from '../utils';

const organizationActions = new StoreActions({
current: function (params = {}, options = {}) {
return this.adapter.get(`${this.namespace}/current`, params, options);
},
});

class Organization extends Resource {
constructor(attributes = {}, adapter, options = {}) {
super(attributes, adapter, 'organization', { actions: organizationActions, ...options });
}
}

export default Organization;
export { organizationActions };
3 changes: 3 additions & 0 deletions types/fleetbase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default class Fleetbase {
vehicles: Store;
vendors: Store;
contacts: Store;
organizations: any;
setAdapter(adapter: any): void;
getAdapter(): any;
}
Expand All @@ -65,6 +66,7 @@ import { Zone } from './resources';
import { ServiceArea } from './resources';
import { ServiceRate } from './resources';
import { ServiceQuote } from './resources';
import { Organization } from './resources';
import { BrowserAdapter } from './adapters';
import { NodeAdapter } from './adapters';
import { EmberJsAdapter } from './adapters';
Expand Down Expand Up @@ -100,6 +102,7 @@ export {
ServiceArea,
ServiceRate,
ServiceQuote,
Organization,
BrowserAdapter,
NodeAdapter,
EmberJsAdapter,
Expand Down
3 changes: 2 additions & 1 deletion types/resources.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import Place from './resources/place';
import Waypoint from './resources/waypoint';
import TrackingStatus from './resources/tracking-status';
import Vehicle from './resources/vehicle';
import Organization from './resources/organization';
import Driver from './resources/driver';
import Vendor from './resources/vendor';
import Contact from './resources/contact';
import Zone from './resources/zone';
import ServiceArea from './resources/service-area';
import ServiceRate from './resources/service-rate';
import ServiceQuote from './resources/service-quote';
export { Order, Payload, Entity, Place, Waypoint, TrackingStatus, Vehicle, Driver, Vendor, Contact, Zone, ServiceArea, ServiceRate, ServiceQuote };
export { Order, Payload, Entity, Place, Waypoint, TrackingStatus, Vehicle, Organization, Driver, Vendor, Contact, Zone, ServiceArea, ServiceRate, ServiceQuote };
6 changes: 6 additions & 0 deletions types/resources/organization.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default Organization;
declare class Organization extends Resource {
constructor(attributes: {}, adapter: any, options?: {});
}
export const organizationActions: any;
import Resource from '../resource';