rms_web_service 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e4456d8e87be3c43e71ff4c8dcdaa64ae6f0737
4
- data.tar.gz: bdb5461405ef0f45c0d67d5531079706bb5b5ec3
3
+ metadata.gz: 7efb329978db4972142f68d5ed11083351067981
4
+ data.tar.gz: 2d6d98185c2623f15b01161368538214f12f490d
5
5
  SHA512:
6
- metadata.gz: df03d83ad6a75e22409231907ac76793c8da2ebc28137ce7c3bf5db96f103cb2312b3d6307299eef595f32641a921e65e3f1126488b60ed4705cacbdd9fe949d
7
- data.tar.gz: 37f4d4611fc5f8fb063303c94a08701ae0155d8f0dcbaeb18aa82968ef5a058e513c8231f956e85ccb125ebc239850ccc06f7df403ec4e79f810545070575c01
6
+ metadata.gz: d5573204d58f7b84981f1f5126de678216048f72234011306c9dd6b1c304ac17585eaa699ccc98566eb65230e7cb96dc2a79cd34997c0ddc2926fbd0cea4055e
7
+ data.tar.gz: 3c49261ef595fd2e8b73e5fa87843995fb9d1c349fcfb7ba9b5d5f73085c667aa541c293035d7f5a6e2a7ebceab18361f66549943521f79cec17ece21966985e
@@ -1,4 +1,3 @@
1
- require 'nokogiri'
2
1
  require 'faraday'
3
2
  require 'active_support'
4
3
  require 'active_support/core_ext'
@@ -27,79 +26,38 @@ module RmsWebService
27
26
 
28
27
  def get(item_url)
29
28
  request = connection('item/get').get {|req| req.params['itemUrl'] = item_url }
30
- return ::RmsWebService::Response::Item::Get.new(request.body)
29
+ return ::RWS::Response::Item::Get.new(request.body)
31
30
  end
32
31
 
33
32
  def insert(args)
34
- xml_object = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
35
- xml.request do
36
- xml.itemInsertRequest do
37
- xml.item do
38
- args.each {|key, value| eval("xml.#{key.to_s.camelize(:lower)} '#{value}'")}
39
- end
40
- end
41
- end
42
- end
43
-
44
- request = connection("item/insert").post {|req| req.body = xml_object.to_xml}
45
- return ::RmsWebService::Response::Item::Insert.new(request.body)
33
+ xml = {:itemInsertRequest => {:item => args}}.to_xml(:root => 'request', :camelize => :lower, :skip_types => true)
34
+ request = connection("item/insert").post {|req| req.body = xml}
35
+ return ::RWS::Response::Item::Insert.new(request.body)
46
36
  end
47
37
 
48
38
  def update(args)
49
- xml_object = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
50
- xml.request do
51
- xml.itemUpdateRequest do
52
- xml.item do
53
- args.each {|key, value| eval("xml.#{key.to_s.camelize(:lower)} '#{value}'")}
54
- end
55
- end
56
- end
57
- end
58
-
59
- request = connection("item/update").post {|req| req.body = xml_object.to_xml}
60
- return ::RmsWebService::Response::Item::Update.new(request.body)
39
+ xml = {:itemUpdateRequest => {:item => args}}.to_xml(:root => 'request', :camelize => :lower, :skip_types => true)
40
+ request = connection("item/update").post {|req| req.body = xml}
41
+ return ::RWS::Response::Item::Update.new(request.body)
61
42
  end
62
43
 
63
44
  def delete(item_url)
64
- xml_object = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
65
- xml.request do
66
- xml.itemDeleteRequest do
67
- xml.item do
68
- xml.itemUrl item_url
69
- end
70
- end
71
- end
72
- end
73
-
74
- request = connection("item/delete").post {|req| req.body = xml_object.to_xml}
75
- return ::RmsWebService::Response::Item::Delete.new(request.body)
45
+ xml = {:itemDeleteRequest => {:item => {:itemUrl => item_url}}}.to_xml(:root => 'request', :camelize => :lower, :skip_types => true)
46
+ request = connection("item/delete").post {|req| req.body = xml}
47
+ return ::RWS::Response::Item::Delete.new(request.body)
76
48
  end
77
49
 
78
50
  def search(args)
79
51
  request = connection("item/search").get do |req|
80
52
  args.each {|key, value| req.params["#{key.to_s.camelize(:lower)}"] = args[:"#{key}"]}
81
53
  end
82
-
83
- return ::RmsWebService::Response::Item::Search.new(request.body)
54
+ return ::RWS::Response::Item::Search.new(request.body)
84
55
  end
85
56
 
86
57
  def items_update(args)
87
- xml_object = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
88
- xml.request do
89
- xml.itemsUpdateRequest do
90
- xml.items do
91
- args.each do |item|
92
- xml.item do
93
- item.each {|key, value| eval("xml.#{key.to_s.camelize(:lower)} '#{value}'")}
94
- end
95
- end
96
- end
97
- end
98
- end
99
- end
100
-
101
- request = connection("items/update").post {|req| req.body = xml_object.to_xml}
102
- return ::RmsWebService::Response::Item::ItemsUpdate.new(request.body)
58
+ xml = {:itemsUpdateRequest => {:items => args}}.to_xml(:root => 'request', :camelize => :lower, :skip_types => true)
59
+ request = connection("items/update").post {|req| req.body = xml}
60
+ return ::RWS::Response::Item::ItemsUpdate.new(request.body)
103
61
  end
104
62
  end
105
63
  end
@@ -13,7 +13,7 @@ module RmsWebService
13
13
  raise RmsWebService::ParameterError, 'service_secret is required' unless service_secret.present?
14
14
  raise RmsWebService::ParameterError, 'license_key is required' unless license_key.present?
15
15
 
16
- "ESA " + Base64.encode64(service_secret + ":" + license_key).gsub("\n", "")
16
+ "ESA " + Base64.strict_encode64(service_secret + ":" + license_key)
17
17
  end
18
18
  end
19
19
  end
@@ -1,3 +1,5 @@
1
+ require 'nokogiri'
2
+
1
3
  module RmsWebService
2
4
  module Response
3
5
  module Item
@@ -1,3 +1,3 @@
1
1
  module RmsWebService
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "faraday"
22
22
  spec.add_dependency "nokogiri"
23
23
  spec.add_dependency "activesupport"
24
+ spec.add_dependency "builder"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.6"
26
27
  spec.add_development_dependency "rake", "~> 10.0"
@@ -19,8 +19,8 @@ describe RmsWebService::Configuration do
19
19
  describe "#encoded_keys" do
20
20
  context "with service_secret and license_key" do
21
21
  let(:encoded_string){
22
- encoded_credentials = Base64.encode64("#{service_secret}:#{license_key}")
23
- "ESA #{encoded_credentials}".gsub("\n", "")
22
+ encoded_credentials = Base64.strict_encode64("#{service_secret}:#{license_key}")
23
+ "ESA #{encoded_credentials}"
24
24
  }
25
25
 
26
26
  subject{ config.encoded_keys }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rms_web_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kamiya54
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-17 00:00:00.000000000 Z
11
+ date: 2014-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: builder
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement