itc-autoingest 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,11 @@ module ITCAutoingest
23
23
  (class << self; self; end).class_eval {
24
24
  define_method("#{timeframe.downcase}_#{report_type.downcase}_#{report_sub_type.sub('-', '').downcase}_report") { |*args|
25
25
  reportdate = (args.length == 0 ? (Time.now - 86400).strftime('%Y%m%d') : args[0])
26
- self.send('ingest', report_type, timeframe, report_sub_type, reportdate)
26
+ self.send('ingest', report_type, timeframe, report_sub_type, reportdate, :report)
27
+ }
28
+ define_method("#{timeframe.downcase}_#{report_type.downcase}_#{report_sub_type.sub('-', '').downcase}_raw") { |*args|
29
+ reportdate = (args.length == 0 ? (Time.now - 86400).strftime('%Y%m%d') : args[0])
30
+ self.send('ingest', report_type, timeframe, report_sub_type, reportdate, :raw)
27
31
  }
28
32
  }
29
33
  }
@@ -33,18 +37,30 @@ module ITCAutoingest
33
37
 
34
38
  private
35
39
 
36
- def ingest(typeofreport, datetype, reporttype, reportdate)
40
+ def ingest(typeofreport, datetype, reporttype, reportdate, outputtype)
37
41
  query = { :TYPEOFREPORT => typeofreport, :DATETYPE => datetype, :REPORTTYPE => reporttype, :REPORTDATE => reportdate }
38
42
  query.merge!(@auth)
39
43
 
40
44
  response = self.class.post( '/autoingestion.tft', :query => query )
41
45
 
42
46
  if response.code != 200
43
- {:error => response.message}
47
+ if outputtype == :raw
48
+ response.message
49
+ else
50
+ {:error => response.message}
51
+ end
44
52
  elsif !response.headers['ERRORMSG'].nil?
45
- {:error => response.headers['ERRORMSG']}
53
+ if outputtype == :raw
54
+ response.headers['ERRORMSG']
55
+ else
56
+ {:error => response.headers['ERRORMSG']}
57
+ end
46
58
  else
47
- hash_response(response.body)
59
+ if outputtype == :raw
60
+ Zlib::GzipReader.new(StringIO.new(response.body)).read
61
+ else
62
+ hash_response(response.body)
63
+ end
48
64
  end
49
65
  end
50
66
 
@@ -1,3 +1,3 @@
1
1
  module ITCAutoingest
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: itc-autoingest
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.1
5
+ version: 1.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Carson McDonald
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-19 00:00:00 Z
13
+ date: 2012-07-27 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements: []
65
65
 
66
66
  rubyforge_project: itc-autoingest
67
- rubygems_version: 1.8.10
67
+ rubygems_version: 1.8.15
68
68
  signing_key:
69
69
  specification_version: 3
70
70
  summary: ITC Autoingest is a gem for fetching iTunes connect reports.