economic-rest 0.5.5 → 0.5.6

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
  SHA256:
3
- metadata.gz: d780a576705228b30854218e3dd475c463123e95639f1e5b81729b3a4daa3ef9
4
- data.tar.gz: b7e95e680b031200f3a19639dbe3e279d810b51ec90504fa1dc8c331ed0d7af8
3
+ metadata.gz: dc4d033f6a75d6511c4093d245efd77f8f89a798041e9f5f9722f68de9154fd1
4
+ data.tar.gz: 68459bf79ebf33bd9df2b468cbe7a66269ea769d5d4cf496b4de5551098de56b
5
5
  SHA512:
6
- metadata.gz: d90a11a66b3e6aa8be543a30111023f5c0e67755d58ae63a8ea457b045800cceb3b5dd00a14910b50777b4ab707fb25777fc9adf3b96cce6cb2aa11b898433e9
7
- data.tar.gz: 749008cdaa3030bfad280157cbc59a10553ca68b73d440f39e3648bef5c12d97b261cf8b5e53aa7d8d73381d2b30c1e7bfa1a8a98447308175b556308bd8b0fa
6
+ metadata.gz: 5056b4552c40fbd19e12f34136ebe5999536442c630be69b00412698e33840b42e3a2591e25f4b73d06e5ae09c9250c2b9112276694663cf3f3abd5569e12163
7
+ data.tar.gz: 2b7067210049c897d4c123c4e6a26725cf02deb8177b867fbfcff8fa14ff0aed1e13aaaf36283cce082afe0f8c6a2e6a8652b6b69ab69eafa49cf5245713eb22
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- economic-rest (0.5.4)
4
+ economic-rest (0.5.6)
5
5
  activesupport
6
6
  rest-client
7
7
  savon
@@ -9,12 +9,12 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.0)
12
+ activesupport (6.0.1)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 0.7, < 2)
15
15
  minitest (~> 5.1)
16
16
  tzinfo (~> 1.1)
17
- zeitwerk (~> 2.1, >= 2.1.8)
17
+ zeitwerk (~> 2.2)
18
18
  addressable (2.5.2)
19
19
  public_suffix (>= 2.0.2, < 4.0)
20
20
  akami (1.3.1)
@@ -113,7 +113,7 @@ GEM
113
113
  addressable (>= 2.3.6)
114
114
  crack (>= 0.3.2)
115
115
  hashdiff
116
- zeitwerk (2.2.0)
116
+ zeitwerk (2.2.1)
117
117
 
118
118
  PLATFORMS
119
119
  ruby
@@ -11,7 +11,7 @@ module Economic
11
11
 
12
12
  def save(model, url: endpoint_url)
13
13
  post_or_put = model.id_key.nil? ? :post : :put
14
- url += "/" + model.id_key.to_s
14
+ url += "/" + id_to_url_formatted_id(model.id_key)
15
15
 
16
16
  response = send_request(method: post_or_put, url: url, payload: model.to_h.to_json)
17
17
 
@@ -54,7 +54,7 @@ module Economic
54
54
  end
55
55
 
56
56
  def find(id, url: endpoint_url)
57
- url += "/" + id.to_s
57
+ url += "/" + id_to_url_formatted_id(id)
58
58
  response = send_request(method: :get, url: url)
59
59
 
60
60
  entry_hash = JSON.parse(response.body)
@@ -66,7 +66,7 @@ module Economic
66
66
  end
67
67
 
68
68
  def destroy(id, url: endpoint_url)
69
- url += "/" + id.to_s
69
+ url += "/" + id_to_url_formatted_id(id)
70
70
  response = send_request(method: :delete, url: url)
71
71
 
72
72
  success_codes = [200, 204]
@@ -85,6 +85,23 @@ module Economic
85
85
  raise e
86
86
  end
87
87
 
88
+ def id_to_url_formatted_id(id)
89
+ id.to_s.gsub("_", "_8_")
90
+ .gsub("<", "_0_")
91
+ .gsub(">", "_1_")
92
+ .gsub("*", "_2_")
93
+ .gsub("%", "_3_")
94
+ .gsub(":", "_4_")
95
+ .gsub("&", "_5_")
96
+ .gsub("/", "_6_")
97
+ .gsub('\\', "_7_")
98
+ .gsub(" ", "_9_")
99
+ .gsub("?", "_10_")
100
+ .gsub(".", "_11_")
101
+ .gsub("#", "_12_")
102
+ .gsub("+", "_13_")
103
+ end
104
+
88
105
  private
89
106
 
90
107
  def model
@@ -4,6 +4,7 @@ module Economic
4
4
  id = product_or_product_number.product_number if product_or_product_number.respond_to? :product_number
5
5
  id ||= product_or_product_number
6
6
 
7
+ id = Economic::BaseRepo.id_to_url_formatted_id(id)
7
8
  end_point = [superclass.endpoint_url, id, "pricing", "currency-specific-sales-prices"].join("/")
8
9
  response = send_request(method: :get, url: URI.escape(end_point))
9
10
  entry_hash = JSON.parse(response.body)
@@ -1,5 +1,5 @@
1
1
  module Economic
2
2
  module Rest
3
- VERSION = "0.5.5".freeze
3
+ VERSION = "0.5.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: economic-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Klogborg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-07 00:00:00.000000000 Z
11
+ date: 2019-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -295,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  - !ruby/object:Gem::Version
296
296
  version: '0'
297
297
  requirements: []
298
- rubygems_version: 3.0.1
298
+ rubygems_version: 3.0.3
299
299
  signing_key:
300
300
  specification_version: 4
301
301
  summary: Ruby wrapper for the e-conomic REST API, that aims at making working with