rms_item_api 0.1.2 → 0.1.3

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: 4adb298a103b9b2ccbe1ae7c56c63b12a6f183be
4
- data.tar.gz: d5abe7537db0e8dcc1a603a157a17945333fb165
3
+ metadata.gz: e9be47ab6a021266fa900564da1bc587be02b84e
4
+ data.tar.gz: 656254172bc1023867e938b250e1c42db9eec542
5
5
  SHA512:
6
- metadata.gz: 3b84634e3399f42d05279bb717ee45f4518986bf8c0b1aba4fc602dba481a3991f0c0042b3c08405074421ac99db0166535be92c6b0a7162e933fc1af738f8d1
7
- data.tar.gz: a678c7a2f2f7fcd50b59fe643473e0629fcdac717dbd1c05e2b3d27e124e36ea02e74c5f90183c19d4564a87c4af46f43a841d3c7325319b4ad5b82592a48b64
6
+ metadata.gz: c63a2beb3b741739c4681f85c1299b6f3828f95d4c594fa47cb5998f7718cf18810cc0c2bcfb73458a6bf3e3ba38d9de5430186d22506f9381927d0091ed9db8
7
+ data.tar.gz: 81795d197aaaf6001e7b8f19897f8723960f9b9d34173c32422de9336ad41e914b49993a7d6d2ac1795490be473c908c60eb1274de4a9b37b7ed94c82099d8d1
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  test_code.rb
10
+ *.gem
data/README.md CHANGED
@@ -20,7 +20,7 @@ RMS内の「[拡張サービス一覧>WEB APIサービス>利用設定](http
20
20
  client = RmsItemApi::RmsItemApi.new(
21
21
  serviceSecret: "your_serviceSecret",
22
22
  licenseKey: "your_licenseKey"
23
- )
23
+ )
24
24
  ```
25
25
 
26
26
  ### Get
@@ -53,7 +53,7 @@ item = client.insert({
53
53
  },
54
54
  item_layout: 2,
55
55
  is_included_postage: true
56
- })
56
+ })
57
57
  ```
58
58
 
59
59
  ### Update
@@ -70,7 +70,7 @@ item = client.update({
70
70
  categoryId: '0000000123'
71
71
  }
72
72
  }
73
- })
73
+ })
74
74
  ```
75
75
 
76
76
  ### Delete
@@ -80,5 +80,5 @@ item = client.update({
80
80
  ```ruby
81
81
  item = client.delete({
82
82
  item_url: 'test123',
83
- })
83
+ })
84
84
  ```
@@ -1,3 +1,3 @@
1
1
  module RmsItemApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/rms_item_api.rb CHANGED
@@ -15,6 +15,12 @@ module RmsItemApi
15
15
  def initialize(serviceSecret:, licenseKey:)
16
16
  @serviceSecret = serviceSecret
17
17
  @licenseKey = licenseKey
18
+ @quiet_option = nil
19
+ end
20
+
21
+ def quiet!
22
+ @quiet_option = true
23
+ self
18
24
  end
19
25
 
20
26
  def get(item_data)
@@ -76,7 +82,7 @@ module RmsItemApi
76
82
  case method
77
83
  when 'Get'
78
84
  if result_code == 'N000'
79
- puts "#{method} succeeded"
85
+ puts "#{method} succeeded" unless @quiet_option
80
86
  xpoint = 'result/itemGetResult/item'
81
87
  parsed_xml.xpath(xpoint).each do |xml|
82
88
  xml.children.each_with_index do |x, index|
@@ -90,7 +96,7 @@ module RmsItemApi
90
96
  z.text.force_encoding('utf-8')
91
97
  }
92
98
  rescue => e
93
- puts e
99
+ puts e unless @quiet_option
94
100
  end
95
101
  end
96
102
  end
@@ -105,11 +111,11 @@ module RmsItemApi
105
111
  end
106
112
  return self
107
113
  else
108
- puts "指定された商品管理番号は存在しません"
114
+ puts "指定された商品管理番号は存在しません" unless @quiet_option
109
115
  end
110
116
  when 'Update', 'Insert', 'Delete'
111
117
  if result_code == 'N000'
112
- puts "#{method} succeeded"
118
+ puts "#{method} succeeded" unless @quiet_option
113
119
  else
114
120
  config_file = "#{File.dirname(__FILE__)}/../config/field_name.yml"
115
121
  field_name = Hashie::Mash.new(YAML.load_file(config_file))
@@ -118,7 +124,7 @@ module RmsItemApi
118
124
  xml.children.each do |x|
119
125
  error_field = x.xpath('fieldId').text
120
126
  error_description = x.xpath('msg').text.force_encoding('utf-8')
121
- puts "#{field_name[error_field]}:#{error_description}"
127
+ puts "#{field_name[error_field]}:#{error_description}" unless @quiet_option
122
128
  end
123
129
  end
124
130
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rms_item_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - t4traw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-02 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday