This repository was archived by the owner on May 28, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 11 files changed +44
-35
lines changed Expand file tree Collapse file tree 11 files changed +44
-35
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
66
7+ ## 2.1.1 - 2017-05-23
8+ ### Fixed
9+ - Attached ` Actions ` resource to global class
10+
711## 2.1.0 - 2017-05-23
812### Added
913- ` setTimezone ` , ` setLanguage ` and ` preferences ` methods to ` Account ` resource
Original file line number Diff line number Diff line change 11{
22 "name" : " deskbookers" ,
3- "version" : " 2.1.0 " ,
3+ "version" : " 2.1.1 " ,
44 "description" : " Deskbookers API JavaScript SDK" ,
55 "main" : " dist/index.js" ,
66 "scripts" : {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- import DeskbookersError from './DeskbookersError'
2-
31const MAX_ERROR_LENGTH = 100
42
5- export default class InvalidResponseError extends DeskbookersError {
3+ export class DeskbookersError extends Error {
4+ constructor ( message ) {
5+ super ( message )
6+ this . name = 'DeskbookersError'
7+ }
8+ }
9+
10+ export class InvalidResponseError extends DeskbookersError {
611 constructor ( text ) {
712 // Prepare text
813 text = `${ text || '' } `
14+
915 if ( text . length > MAX_ERROR_LENGTH ) {
1016 text = `${ text . substr ( 0 , MAX_ERROR_LENGTH ) } ...`
1117 }
Original file line number Diff line number Diff line change 1- import Account from './resources/account'
2- import Cart from './resources/Cart'
3- import Events from './resources/Events'
4- import Workplaces from './resources/Workplaces'
1+ import resources from './resources'
52
63const API_HOST = 'backoffice.2cnnct.com'
74const API_VERSION = 1
85const API_LANGUAGE = 'en-gb'
96const API_RESELLER_ID = 10000
107
11- const resources = {
12- account : Account ,
13- cart : Cart ,
14- events : Events ,
15- workplaces : Workplaces
16- }
17-
188export default class Deskbookers {
199 constructor ( {
2010 https = true ,
@@ -31,9 +21,9 @@ export default class Deskbookers {
3121 this . resellerId = resellerId
3222 this . session = null
3323
34- // Init resources
35- for ( let name in resources ) {
36- this [ name ] = new resources [ name ] ( this )
24+ // Initialise resources
25+ for ( const resource in resources ) {
26+ this [ resource ] = new resources [ resource ] ( this )
3727 }
3828 }
3929}
Original file line number Diff line number Diff line change 11import Resource from './Resource'
2- import DeskbookersError from '../DeskbookersError '
2+ import { DeskbookersError } from '../errors '
33
44export default class Events extends Resource {
55 constructor ( api ) {
Original file line number Diff line number Diff line change 11import { signer , formatArgs } from '../utils/requests'
2- import DeskbookersError from '../DeskbookersError'
3- import InvalidResponseError from '../InvalidResponseError'
2+ import {
3+ DeskbookersError ,
4+ InvalidResponseError
5+ } from '../errors'
46
57export default class Resource {
68 constructor ( api ) {
Original file line number Diff line number Diff line change 11import Resource from './Resource'
2- import DeskbookersError from '../DeskbookersError '
2+ import { DeskbookersError } from '../errors '
33
44export default class Workplaces extends Resource {
55 constructor ( api ) {
Original file line number Diff line number Diff line change 1- import DeskbookersError from '../../DeskbookersError '
1+ import { DeskbookersError } from '../../errors '
22import Resource from '../Resource'
33import { pickAll } from 'ramda'
44
Original file line number Diff line number Diff line change 1+ import Account from './account'
2+ import Actions from './Actions'
3+ import Cart from './Cart'
4+ import Events from './Events'
5+ import Workplaces from './Workplaces'
6+
7+ export default {
8+ account : Account ,
9+ actions : Actions ,
10+ cart : Cart ,
11+ events : Events ,
12+ workplaces : Workplaces
13+ }
You can’t perform that action at this time.
0 commit comments