teamwork_scrape_client 0.1.2 → 0.1.3
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/teamwork_scrape_client/client.rb +30 -8
- data/lib/teamwork_scrape_client/version.rb +1 -1
- data/teamwork_scrape_client.gemspec +1 -1
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 38bad3230d692bf2c6d55412e4100e001954a0ca23385798862b534da0c412d8
|
4
|
+
data.tar.gz: 1b0916007985f2205f37d7897eeafd2cf903cb7cc416c038292db2caede76f3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28666b29956ffdf3125140d930bc891aec7549f2732400433e38e8229e05dc8b743728d01435183e47179b4aa275242003f8259f51c7f77ed11035a887a57808
|
7
|
+
data.tar.gz: a95dcd0e13c50633bc2567c361cc6fbabac20b05bffbb846b3651a889f4e27ebefa6ac8fec2677ee5de18a60507e849dc1a824452a9ffc1822feb445892f4444
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
require 'json'
|
3
|
+
require 'date'
|
3
4
|
|
4
5
|
module TeamworkScrapeClient
|
5
6
|
class Client
|
@@ -21,6 +22,8 @@ module TeamworkScrapeClient
|
|
21
22
|
def mech
|
22
23
|
@mech ||= Mechanize.new do |m|
|
23
24
|
m.log = Logger.new(STDOUT) if debug
|
25
|
+
# Set the timeout to 15 minutes because copying can be SLOW
|
26
|
+
m.read_timeout = 15 * 60
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
@@ -28,7 +31,7 @@ module TeamworkScrapeClient
|
|
28
31
|
mech.post(
|
29
32
|
"#{base_url}/v/1/login.json?getInitialPage=true",
|
30
33
|
{ username: email, password: password, rememberMe: false }.to_json,
|
31
|
-
|
34
|
+
'Content-Type' => 'application/json'
|
32
35
|
)
|
33
36
|
end
|
34
37
|
|
@@ -90,37 +93,56 @@ module TeamworkScrapeClient
|
|
90
93
|
|
91
94
|
old_project = project(old_project_id)
|
92
95
|
|
93
|
-
|
94
|
-
'/index.cfm',
|
95
|
-
action: 'CloneProject_CreateProjectClone',
|
96
|
+
request_body = {
|
96
97
|
id: old_project_id,
|
97
98
|
installationId: account['id'],
|
99
|
+
sourceInstallationId: account['id'],
|
98
100
|
'cloneproject-action' => 'copy',
|
99
101
|
cloneProjectName: new_project_name,
|
102
|
+
copyBudgets: 'NO',
|
100
103
|
copyTasks: 'YES',
|
101
104
|
copyMilestones: 'YES',
|
102
105
|
copyMessages: 'YES',
|
103
106
|
copyFiles: 'YES',
|
107
|
+
copyFollowers: "YES",
|
108
|
+
copyForms: "NO",
|
104
109
|
copyLinks: 'YES',
|
105
110
|
copyNotebooks: 'YES',
|
106
|
-
copyTimelogs: '
|
107
|
-
copyInvoices: '
|
111
|
+
copyTimelogs: 'NO',
|
112
|
+
copyInvoices: 'NO',
|
108
113
|
copyExpenses: 'YES',
|
109
114
|
copyRisks: 'YES',
|
110
115
|
copyPeople: 'YES',
|
116
|
+
copyProjectPrivacy: 'YES',
|
117
|
+
copyProjectUpdates: 'NO',
|
111
118
|
daysOffset: old_project.days_offset,
|
119
|
+
description: '',
|
112
120
|
keepOffWeekends: '1',
|
113
121
|
createActivityLog: 'YES',
|
114
122
|
createItemsUsingCurrentUser: 'NO',
|
115
123
|
uncomplete: 'YES',
|
116
124
|
copyComments: 'YES',
|
117
125
|
copyProjectRoles: 'YES',
|
118
|
-
copyLogo: '
|
126
|
+
copyLogo: 'NO',
|
119
127
|
companyId: existing_company_id || 0,
|
120
|
-
newCompanyName: existing_company_id ? '' : new_company_name
|
128
|
+
newCompanyName: existing_company_id ? '' : new_company_name,
|
129
|
+
targetDate: today,
|
130
|
+
newFromTemplate: false,
|
131
|
+
tagIds: '',
|
132
|
+
toTemplate: false
|
133
|
+
}
|
134
|
+
|
135
|
+
response = mech.post(
|
136
|
+
"/projects/#{old_project_id}/clone.json",
|
137
|
+
request_body.to_json,
|
138
|
+
'Content-Type' => 'application/json'
|
121
139
|
)
|
122
140
|
|
123
141
|
JSON.parse(response.body)
|
124
142
|
end
|
143
|
+
|
144
|
+
def today
|
145
|
+
Date.today.strftime('%Y%m%d')
|
146
|
+
end
|
125
147
|
end
|
126
148
|
end
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency "bundler"
|
22
|
+
spec.add_development_dependency "bundler"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
25
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamwork_scrape_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Mason
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,7 +92,7 @@ homepage: https://github.com/ericmason/equisolve-teamwork_scrape_client
|
|
92
92
|
licenses:
|
93
93
|
- MIT
|
94
94
|
metadata: {}
|
95
|
-
post_install_message:
|
95
|
+
post_install_message:
|
96
96
|
rdoc_options: []
|
97
97
|
require_paths:
|
98
98
|
- lib
|
@@ -107,9 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
|
111
|
-
|
112
|
-
signing_key:
|
110
|
+
rubygems_version: 3.0.8
|
111
|
+
signing_key:
|
113
112
|
specification_version: 4
|
114
113
|
summary: Unofficial Teamwork.com scraping client to supplement the official API
|
115
114
|
test_files: []
|