wegift-ruby-client 1.8.4 → 1.9.0

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
- SHA256:
3
- metadata.gz: 2a0bea732c45e915a0b2b07bc3a531fe50fc8b3358c379c36b23f7e16058af6b
4
- data.tar.gz: 7698179a267ced67e826129bc11bd63d24236b739fd32faf84db4b540c9d96bb
2
+ SHA1:
3
+ metadata.gz: bed3c1cbd45d744b02c6737ad4f55f49cbb71c28
4
+ data.tar.gz: ec366ffec07bc3905f63123bcd6272745a67699e
5
5
  SHA512:
6
- metadata.gz: 508ca0abc61ab408ec77502762e196294e2705e5823e1ba66dceecffc6df6f164b2b746237aeab2bef1dfb92b48468b7b99ce2300394e98a1cf1cbdc30d5ce02
7
- data.tar.gz: 61fa5b052ec2ce76b55ee6c69c650c56b502c25ad76eeaf3abcfae8f3d64d2631e8c5355558bae0dd262af324793db771e6718b4f3a5d3362a69f00ac9bc275e
6
+ metadata.gz: b5a9b590644a45bff06e13a144ed9fffaf6ac296fa46e620a10e579a6fa676027cc542f0556db5210cdf46059f51759fdc9497a4ccea033a14d06922fc473933
7
+ data.tar.gz: 85e5ec40f0dbb637fbfe1dabad2262482583ebf52edc69496929ca5bb8dff4afd7a675e42d58e7b25b98d545c7b499b0da8df76f676ae2c767385f199e91441d
data/lib/wegift/client.rb CHANGED
@@ -6,6 +6,7 @@ require_relative 'models/response'
6
6
  require_relative 'models/product'
7
7
  require_relative 'models/products'
8
8
  require_relative 'models/order'
9
+ require_relative 'models/stock'
9
10
 
10
11
  module Wegift
11
12
  class Client
@@ -58,5 +59,10 @@ module Wegift
58
59
  order = Wegift::Order.new(options)
59
60
  order.post(self)
60
61
  end
62
+
63
+ def stock(id)
64
+ stock = Wegift::Stock.new(product_code: id)
65
+ stock.get(self)
66
+ end
61
67
  end
62
68
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Wegift::Stock < Wegift::Response
4
+ PATH = '/stock'
5
+
6
+ # request/payload
7
+ attr_accessor :product_code
8
+
9
+ # response/success
10
+ attr_accessor :available_stock, :currency_code, :product_code, :product_name
11
+
12
+ def initialize(params = {})
13
+ super
14
+ end
15
+
16
+ def path
17
+ [PATH, product_code.to_s].join('/')
18
+ end
19
+
20
+ # Product Stock
21
+ # GET /api/b2b-sync/v1/stock/ID
22
+ def get(ctx)
23
+ response = ctx.request(:get, path)
24
+ parse(response)
25
+ end
26
+
27
+ def parse(response)
28
+ super
29
+
30
+ self
31
+ end
32
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Wegift
4
4
  # api-version.lib-build
5
- VERSION = '1.8.4'
5
+ VERSION = '1.9.0'
6
6
  end
data/lib/wegift.rb CHANGED
@@ -8,6 +8,7 @@ require 'wegift/models/response'
8
8
  require 'wegift/models/product'
9
9
  require 'wegift/models/products'
10
10
  require 'wegift/models/order'
11
+ require 'wegift/models/stock'
11
12
 
12
13
  module Wegift
13
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wegift-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaas Endrikat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2022-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -34,22 +34,22 @@ dependencies:
34
34
  name: json
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 2.3.0
40
37
  - - "~>"
41
38
  - !ruby/object:Gem::Version
42
39
  version: '2.3'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.3.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 2.3.0
50
47
  - - "~>"
51
48
  - !ruby/object:Gem::Version
52
49
  version: '2.3'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.3.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -82,22 +82,22 @@ dependencies:
82
82
  name: dotenv
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: 2.2.0
88
85
  - - "~>"
89
86
  - !ruby/object:Gem::Version
90
87
  version: '2.2'
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 2.2.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: 2.2.0
98
95
  - - "~>"
99
96
  - !ruby/object:Gem::Version
100
97
  version: '2.2'
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 2.2.0
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: rake
103
103
  requirement: !ruby/object:Gem::Requirement
@@ -150,22 +150,22 @@ dependencies:
150
150
  name: webmock
151
151
  requirement: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- version: 3.5.0
156
153
  - - "~>"
157
154
  - !ruby/object:Gem::Version
158
155
  version: '3.5'
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: 3.5.0
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- version: 3.5.0
166
163
  - - "~>"
167
164
  - !ruby/object:Gem::Version
168
165
  version: '3.5'
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: 3.5.0
169
169
  description:
170
170
  email:
171
171
  - klaas.endrikat@googlemail.com
@@ -192,6 +192,7 @@ files:
192
192
  - lib/wegift/models/product.rb
193
193
  - lib/wegift/models/products.rb
194
194
  - lib/wegift/models/response.rb
195
+ - lib/wegift/models/stock.rb
195
196
  - lib/wegift/version.rb
196
197
  - wegift-ruby-client.gemspec
197
198
  homepage: https://github.com/kendrikat/wegift-ruby-client
@@ -213,7 +214,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
214
  - !ruby/object:Gem::Version
214
215
  version: '0'
215
216
  requirements: []
216
- rubygems_version: 3.0.8
217
+ rubyforge_project:
218
+ rubygems_version: 2.5.2
217
219
  signing_key:
218
220
  specification_version: 4
219
221
  summary: A simple Ruby client for the WEGIFT API