projector_pws 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/projector_pws/version.rb +1 -1
- data/lib/projector_pws.rb +99 -19
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 591ece8434a945f7640e14645d5fc9ef689b3af96b6af51b6fc4bccdfba9f405
         | 
| 4 | 
            +
              data.tar.gz: 35184f77ecd41e887ddff969081aab638147b62495c8c6d1cda3654f64e462bc
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9b773aaeb3803e00721051d0c155fac9435077a3f64dce085f361f9c7ec03d1f628c46624ebf896358f8c2af170487a2659cce930a109ffc233f223882dd36e2
         | 
| 7 | 
            +
              data.tar.gz: 92c6dd4fd7b93ff038b417ff6401262964d6f60b61531aa78e5e98b0f2341f50dada9472d085484f8617a26ddbce20da82b4f18f3de87447e2a1be5ac8833bb4
         | 
    
        data/lib/projector_pws.rb
    CHANGED
    
    | @@ -25,10 +25,11 @@ module ProjectorPWS | |
| 25 25 | 
             
            	# Namespaces
         | 
| 26 26 | 
             
            	NAMESPACE = 'http://projectorpsa.com/PwsProjectorServices/'
         | 
| 27 27 | 
             
            	EXTRA_NAMESPACES = {
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 28 | 
            +
            			'xmlns:req' => 'http://projectorpsa.com/DataContracts/Requests/',
         | 
| 29 | 
            +
            			'xmlns:tim' => 'http://projectorpsa.com/DataContracts/Shared/TimeAndCost/',
         | 
| 30 | 
            +
            			'xmlns:rep' => 'http://projectorpsa.com/DataContracts/Shared/Report/',
         | 
| 31 | 
            +
            			'xmlns:com' => 'http://projectorpsa.com/DataContracts/Shared/Common/',
         | 
| 32 | 
            +
            			'xmlns:sch' => 'http://projectorpsa.com/DataContracts/Shared/Scheduling/'
         | 
| 32 33 | 
             
            	}
         | 
| 33 34 |  | 
| 34 35 | 
             
            	# Work Week
         | 
| @@ -124,9 +125,77 @@ module ProjectorPWS | |
| 124 125 | 
             
            		c.call(:pws_get_report_output, message: { 'pws:serviceRequest' => params }).body
         | 
| 125 126 | 
             
            	end
         | 
| 126 127 |  | 
| 128 | 
            +
            	# Get Project List
         | 
| 129 | 
            +
            	def self.get_projects c, ticket, engagement_code = nil
         | 
| 130 | 
            +
            		# Prepare Params
         | 
| 131 | 
            +
            		params = {'req:SessionTicket' => ticket }
         | 
| 132 | 
            +
            		params['sch:QueryString'] = engagement_code.to_s if engagement_code
         | 
| 133 | 
            +
            		# Fetch Projects
         | 
| 134 | 
            +
            		c.call(:pws_get_project_list, message: {'pws:serviceRequest' => params }).body[:pws_get_project_list_response][:pws_get_project_list_result][:projects][:pws_project_summary]
         | 
| 135 | 
            +
            	end
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            	# Get Project Details
         | 
| 138 | 
            +
            	def self.get_project c, ticket, project_uid
         | 
| 139 | 
            +
            		# prepare params
         | 
| 140 | 
            +
            		params = {'req:SessionTicket' => ticket }
         | 
| 141 | 
            +
            		params['sch:Mode'] = "R"
         | 
| 142 | 
            +
            		# Had to build  the Hash this way to counter 'String not Matched Issue', ruby -v 2.5.1, rails -v 5.1.6
         | 
| 143 | 
            +
            		if project_uid
         | 
| 144 | 
            +
            			params['sch:ProjectIdentities'] = {'com:PwsProjectRef' =>  { 'com:ProjectUid' => project_uid } }
         | 
| 145 | 
            +
            		end
         | 
| 146 | 
            +
             | 
| 147 | 
            +
            		# Fetch Project Details
         | 
| 148 | 
            +
            		c.call(:pws_get_project, message: {'pws:serviceRequest' => params}).body[:pws_get_project_response][:pws_get_project_result][:projects][:pws_project_element]
         | 
| 149 | 
            +
            	end
         | 
| 150 | 
            +
             | 
| 151 | 
            +
            	# Get Project Time Baseline
         | 
| 152 | 
            +
            	def self.get_project_time_baseline c, ticket, time_baseline_uid
         | 
| 153 | 
            +
            		# prepare params
         | 
| 154 | 
            +
            		params = {'req:SessionTicket' => ticket}
         | 
| 155 | 
            +
            		raise "Time Baseline Uid Missing" if !time_baseline_uid
         | 
| 156 | 
            +
            		params['sch:ProjectTimeBaselineIdentities'] = {'com:PwsProjectTimeBaselineRef' => {'com:ProjectTimeBaselineUid' => time_baseline_uid}}
         | 
| 157 | 
            +
            		# Fetch Time Baseline Info
         | 
| 158 | 
            +
            		c.call(:pws_get_project_time_baseline, message: { 'pws:serviceRequest' => params}).body[:pws_get_project_time_baseline_response][:pws_get_project_time_baseline_result][:project_time_baselines][:pws_project_time_baseline_element]
         | 
| 159 | 
            +
            	end
         | 
| 160 | 
            +
             | 
| 161 | 
            +
            	# Get Project Time Baselines
         | 
| 162 | 
            +
            	def self.get_project_time_baselines c, ticket, time_baseline_uids
         | 
| 163 | 
            +
            		# prepare params
         | 
| 164 | 
            +
            		params = {'req:SessionTicket' => ticket}
         | 
| 165 | 
            +
            		raise "Time Baseline Uids Missing" unless time_baseline_uids.is_a?(Array)
         | 
| 166 | 
            +
            		params['sch:ProjectTimeBaselineIdentities'] = time_baseline_uids.collect { |i| { 'com:PwsProjectTimeBaselineRef' => { 'com:ProjectTimeBaselineUid' => i } } }
         | 
| 167 | 
            +
            		# Fetch Time Baseline Info
         | 
| 168 | 
            +
            		c.call(:pws_get_project_time_baseline, message: { 'pws:serviceRequest' => params}).body[:pws_get_project_time_baseline_response][:pws_get_project_time_baseline_result][:project_time_baselines][:pws_project_time_baseline_element]
         | 
| 169 | 
            +
            	end
         | 
| 170 | 
            +
             | 
| 171 | 
            +
            	def self.get_engagement c, ticket, engagement_uid
         | 
| 172 | 
            +
            		raise "Engagement Code Needed" if !engagement_uid
         | 
| 173 | 
            +
            		# prepare params
         | 
| 174 | 
            +
            		params = {'req:SessionTicket' => ticket }
         | 
| 175 | 
            +
            		params['sch:EngagementIdentities'] = {'com:PwsEngagementRef' => {'com:EngagementUid' => engagement_uid}}
         | 
| 176 | 
            +
            		# Fetch Engagement Details
         | 
| 177 | 
            +
            		c.call(:pws_get_engagement, message: {'pws:serviceRequest' => params}).body[:pws_get_engagement_response][:pws_get_engagement_result][:engagements][:pws_engagement_element]
         | 
| 178 | 
            +
            	end
         | 
| 179 | 
            +
             | 
| 180 | 
            +
            	def self.get_engagements c, ticket, include_closed = false, max_rows = nil
         | 
| 181 | 
            +
            		# Prepare Params
         | 
| 182 | 
            +
            		params = {'req:SessionTicket' => ticket }
         | 
| 183 | 
            +
            		params['sch:IncludeClosedFlag'] = include_closed if include_closed && (include_closed.class == TrueClass || include_closed.class == FalseClass)
         | 
| 184 | 
            +
            		params['sch:MaxRowsToReturn'] = max_rows if max_rows && max_rows.class == Integer
         | 
| 185 | 
            +
            		# Fetch Engagement List
         | 
| 186 | 
            +
            		c.call(:pws_get_engagement_list, message: {'pws:serviceRequest' => params}).body[:pws_get_engagement_list_response][:pws_get_engagement_list_result][:engagements][:pws_engagement_summary]
         | 
| 187 | 
            +
            	end
         | 
| 188 | 
            +
             | 
| 189 | 
            +
            	def self.get_client c, ticket, client_number
         | 
| 190 | 
            +
            		raise "Client Uid missing" if !client_number
         | 
| 191 | 
            +
            		params = {'req:SessionTicket' => ticket }
         | 
| 192 | 
            +
            		params['req:ClientIdentities'] = { 'com:PwsClientRef' => { 'com:ClientNumber' => client_number }}
         | 
| 193 | 
            +
            		# Fetch Client Details
         | 
| 194 | 
            +
            		c.call(:pws_get_client, message: {'pws:serviceRequest' => params}).body[:pws_get_client_response][:pws_get_client_result][:clients]
         | 
| 195 | 
            +
            	end
         | 
| 196 | 
            +
             | 
| 127 197 | 
             
            	# Get Resources
         | 
| 128 198 | 
             
            	def self.get_resources c, ticket, include_inactive = false
         | 
| 129 | 
            -
             | 
| 130 199 | 
             
            		# Prepare Params
         | 
| 131 200 | 
             
            		params = { 'req:SessionTicket' => ticket }
         | 
| 132 201 | 
             
            		params['req:IncludeInactiveFlag'] = include_inactive
         | 
| @@ -135,15 +204,24 @@ module ProjectorPWS | |
| 135 204 | 
             
            		c.call(:pws_get_resource_list, message: { 'pws:serviceRequest' => params }).body[:pws_get_resource_list_response][:pws_get_resource_list_result][:resources][:pws_resource_summary]
         | 
| 136 205 | 
             
            	end
         | 
| 137 206 |  | 
| 207 | 
            +
            	# Get Single Resource
         | 
| 208 | 
            +
            	def self.get_user c, ticket, user_uid
         | 
| 209 | 
            +
            		params = { 'req:SessionTicket' => ticket }
         | 
| 210 | 
            +
            		# Prepare Params
         | 
| 211 | 
            +
            		params['req:UserIdentities'] = { 'com:PwsUserRef' => { 'com:UserUid' => user_uid }}
         | 
| 212 | 
            +
            		# Fetch Resource Details
         | 
| 213 | 
            +
            		c.call(:pws_get_user, message: {'pws:serviceRequest' => params})
         | 
| 214 | 
            +
            	end
         | 
| 215 | 
            +
             | 
| 216 | 
            +
             | 
| 138 217 | 
             
            	# Get Resource Time Entry Time Off
         | 
| 139 218 | 
             
            	def self.get_time_entry_time_off c, ticket, resource_uid, start_date = current_week_start, end_date = current_week_end
         | 
| 140 219 |  | 
| 141 220 | 
             
            		# Prepare Params
         | 
| 142 | 
            -
            		params = { | 
| 221 | 
            +
            		params = {'req:SessionTicket' => ticket }
         | 
| 143 222 | 
             
            		params['tim:EndDate'] = end_date.strftime '%Y-%m-%dz'
         | 
| 144 223 | 
             
            		params['tim:ResourceIdentity'] = { 'com:ResourceUid' => resource_uid } if resource_uid
         | 
| 145 224 | 
             
            		params['tim:StartDate'] = start_date.strftime '%Y-%m-%dz'
         | 
| 146 | 
            -
             | 
| 147 225 | 
             
            		# Fetch Time Entry Time Off
         | 
| 148 226 | 
             
            		c.call(:pws_get_time_entry_time_off, message: { 'pws:serviceRequest' => params }).body[:pws_get_time_entry_time_off_response][:pws_get_time_entry_time_off_result].try(:[], :time_entry_time_off).try(:[], :pws_time_entry_time_off)
         | 
| 149 227 | 
             
            	end
         | 
| @@ -271,12 +349,12 @@ module ProjectorPWS | |
| 271 349 | 
             
            		params['tim:SendApprovalToPayEmailFlag'] = send_approval_to_pay_email
         | 
| 272 350 | 
             
            		params['tim:SendPaidEmailFlag'] = send_paid_email
         | 
| 273 351 | 
             
            		params['tim:StatusOrders'] = {
         | 
| 274 | 
            -
             | 
| 275 | 
            -
             | 
| 276 | 
            -
             | 
| 277 | 
            -
             | 
| 352 | 
            +
            				'tim:PwsCostPwsChangeOrder' => {
         | 
| 353 | 
            +
            						'tim:ApproveToPayFlag' => true,
         | 
| 354 | 
            +
            						'tim:CostCardIdentities' => {
         | 
| 355 | 
            +
            								'tim:PwsVersionedCostCardRef' => cost_card_uids.collect { |cc| { 'com:CostCardUid' => cc } }
         | 
| 356 | 
            +
            						}
         | 
| 278 357 | 
             
            				}
         | 
| 279 | 
            -
            			}
         | 
| 280 358 | 
             
            		}
         | 
| 281 359 |  | 
| 282 360 | 
             
            		# Set Cost Card Payment Workflow Status
         | 
| @@ -291,8 +369,8 @@ module ProjectorPWS | |
| 291 369 |  | 
| 292 370 | 
             
            		# Collect free time
         | 
| 293 371 | 
             
            		res.collect { |r| {
         | 
| 294 | 
            -
             | 
| 295 | 
            -
             | 
| 372 | 
            +
            				resource: r,
         | 
| 373 | 
            +
            				free_hours: get_resource_free_hours(c, ticket, r, start_date, end_date).to_f
         | 
| 296 374 | 
             
            		} }.select { |x| x[:free_hours] > 0 }
         | 
| 297 375 | 
             
            	end
         | 
| 298 376 |  | 
| @@ -321,11 +399,13 @@ module ProjectorPWS | |
| 321 399 | 
             
            	end
         | 
| 322 400 |  | 
| 323 401 | 
             
            	# Get Resource Free Hours
         | 
| 324 | 
            -
            	def self.get_resource_free_hours c, ticket, resource, start_date = current_week_start, end_date = current_week_end, scheduled_hours = nil, wsched = nil
         | 
| 402 | 
            +
            	def self.get_resource_free_hours c, ticket, resource, start_date = current_week_start, end_date = current_week_end, scheduled_hours = nil, wsched = nil, logger
         | 
| 325 403 |  | 
| 326 404 | 
             
            		# Get scheduled hours
         | 
| 327 405 | 
             
            		scheduled_hours ||= get_resource_scheduled_hours c, ticket, resource, start_date, end_date
         | 
| 328 | 
            -
            		compute_resource_free_hours scheduled_hours, wsched
         | 
| 406 | 
            +
            		free_hours = compute_resource_free_hours scheduled_hours, wsched
         | 
| 407 | 
            +
            		logger.info "#FREE HOURS: #{free_hours}"
         | 
| 408 | 
            +
            		free_hours
         | 
| 329 409 | 
             
            	end
         | 
| 330 410 |  | 
| 331 411 | 
             
            	# Get Resource Active Hours
         | 
| @@ -387,9 +467,9 @@ module ProjectorPWS | |
| 387 467 | 
             
            		end
         | 
| 388 468 |  | 
| 389 469 | 
             
            		{
         | 
| 390 | 
            -
             | 
| 391 | 
            -
             | 
| 392 | 
            -
             | 
| 470 | 
            +
            				work: scheduled_minutes.to_f / MINUTES_PER_HOUR.to_f,
         | 
| 471 | 
            +
            				toff: time_off_minutes.to_f / MINUTES_PER_HOUR.to_f,
         | 
| 472 | 
            +
            				hday: holiday_minutes.to_f / MINUTES_PER_HOUR.to_f
         | 
| 393 473 | 
             
            		}
         | 
| 394 474 | 
             
            	end
         | 
| 395 475 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: projector_pws
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Paul DUNCAN
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2019-06-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 116 116 | 
             
                  version: '0'
         | 
| 117 117 | 
             
            requirements: []
         | 
| 118 118 | 
             
            rubyforge_project: 
         | 
| 119 | 
            -
            rubygems_version: 2. | 
| 119 | 
            +
            rubygems_version: 2.7.8
         | 
| 120 120 | 
             
            signing_key: 
         | 
| 121 121 | 
             
            specification_version: 4
         | 
| 122 122 | 
             
            summary: Projector PWS Client Library
         |