tender_import 0.0.2 → 0.0.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.
@@ -1,4 +1,4 @@
1
1
  module TenderImport
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
4
4
 
@@ -7,11 +7,11 @@ require 'logger'
7
7
  # Produce a Tender import archive from a ZenDesk site using the ZenDesk API.
8
8
  class TenderImport::ZendeskApiImport
9
9
  class Error < StandardError; end
10
- class ResponseJSON < Faraday::Response::Middleware
11
- def parse(body)
12
- Yajl::Parser.parse(body)
13
- end
14
- end
10
+ #class ResponseJSON < Faraday::Response::Middleware
11
+ # def parse(body)
12
+ # Yajl::Parser.parse(body)
13
+ # end
14
+ #end
15
15
 
16
16
  module Log # {{{
17
17
  attr_reader :logger
@@ -39,7 +39,8 @@ class TenderImport::ZendeskApiImport
39
39
  @logger = opts[:logger] || Logger.new(STDOUT).tap {|l| l.level = Logger::INFO}
40
40
  @conn = Faraday::Connection.new("http://#{subdomain}.zendesk.com") do |b|
41
41
  b.adapter :net_http
42
- b.use ResponseJSON
42
+ #b.use ResponseJSON
43
+ b.response :yajl
43
44
  end
44
45
  conn.basic_auth(opts[:email], opts[:password])
45
46
  end
@@ -87,7 +88,7 @@ class TenderImport::ZendeskApiImport
87
88
  debug "fetching #{resource_url}"
88
89
  loop do
89
90
  response = conn.get(resource_url)
90
- if response.success?
91
+ if response.success? && !response.body.kind_of? String
91
92
  return resource_key ? response.body[resource_key] : response.body
92
93
  elsif response.status == 503
93
94
  log "got a 503 (API throttle), waiting 30 seconds..."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tender_import
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Zack Hobson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-10 00:00:00 -07:00
18
+ date: 2011-09-08 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency