itunes-connect 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/itunes_connect/connection.rb +25 -5
  2. metadata +4 -4
@@ -186,16 +186,21 @@ module ItunesConnect
186
186
  end.submit
187
187
  end
188
188
 
189
+ # get ajax id from the given page.
190
+ # used to set AJAXREQUEST parameter.
191
+ # example html: AJAX.Submit('theForm:j_id_jsp_4933398_2'
192
+ def get_ajax_id(page)
193
+ ajax_id = page.body.match(/AJAX\.Submit\('([^\']+)'/)[1] rescue nil
194
+ raise "could not determine form AJAX id" unless ajax_id
195
+ ajax_id
196
+ end
197
+
189
198
  # fetch main report page (sales.faces)
190
199
  def fetch_report_page
191
200
  @report_page = client.get(REPORT_URL)
192
201
  dump(client, @report_page)
193
202
 
194
- # get ajax parameter name for AJAXREQUEST (<a> id)
195
- # AJAX.Submit('theForm:j_id_jsp_4933398_2'
196
- @ajax_id = @report_page.body.match(/AJAX\.Submit\('([^\']+)'/)[1] rescue nil
197
- raise "could not determine form AJAX id" unless @ajax_id
198
-
203
+ @ajax_id = get_ajax_id(@report_page)
199
204
  @report_page
200
205
  end
201
206
 
@@ -247,6 +252,21 @@ module ItunesConnect
247
252
  page2 = client.click(sales_link)
248
253
  dump(client, page2)
249
254
 
255
+ # submit body onload form
256
+ # setUpdefaultVendorNavigation()
257
+ debug_msg("setting default vendor navigation")
258
+ page_param = page2.body.match(/parameters':\{'(.*?)'/)[1] rescue nil
259
+ raise "could not determine defaultVendorPage parameter" unless page_param
260
+
261
+ page2.form_with(:name => 'defaultVendorPage') do |form|
262
+ form['AJAXREQUEST'] = get_ajax_id(page2)
263
+ form[page_param] = page_param
264
+
265
+ debug_form(form)
266
+ end.submit
267
+
268
+ debug_msg("finished login")
269
+
250
270
  @report_page = nil # clear any cached report page
251
271
  @logged_in = true
252
272
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itunes-connect
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 10
8
+ - 11
9
9
  - 0
10
- version: 0.10.0
10
+ version: 0.11.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Vollmer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-22 00:00:00 +09:30
18
+ date: 2010-10-09 00:00:00 +10:30
19
19
  default_executable: itunes_connect
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency