Skip to content

Commit

Permalink
Set client parser
Browse files Browse the repository at this point in the history
  • Loading branch information
hakanensari committed Aug 14, 2014
1 parent 8becc4f commit 4fc51fd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 0 additions & 8 deletions lib/mws-orders.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
require "peddler"
require "mws/orders/parser"

module MWS
def self.orders(*args)
Orders::Client.new(*args).tap do |client|
client.parser = Orders::Parser
end
end
end
3 changes: 3 additions & 0 deletions lib/mws/orders/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ def find_result_node
root.children.find { |node| node.name.include?("Result") }
end
end

# Override Peddler's default Parser.
Client.parser = Parser
end
end
2 changes: 1 addition & 1 deletion mws-orders.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |gem|

gem.add_dependency "money", "~> 6.0"
gem.add_dependency "nokogiri", "~> 1.5"
gem.add_dependency "peddler", "~> 0.9.0"
gem.add_dependency "peddler", "~> 0.9.2"
gem.add_dependency "structure", "~> 0.29.0"
gem.required_ruby_version = ">= 1.9"
end
7 changes: 7 additions & 0 deletions test/mws/orders/test_parser.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "test_helper"

class TestParser < MiniTest::Test
def test_overrides_peddlers_parser
assert_equal Parser, Client.parser
end
end

0 comments on commit 4fc51fd

Please sign in to comment.