wegift-ruby-client 1.9.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/lib/wegift/client.rb +6 -0
- data/lib/wegift/models/remote_code.rb +28 -0
- data/lib/wegift/version.rb +1 -1
- data/wegift-ruby-client.gemspec +1 -1
- metadata +28 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bda228cc47c4df8a18a836cee01bd9351c41de9ccf641143ba164329bf224060
|
4
|
+
data.tar.gz: 27183b59e542f68676910aaff9ee6d76d77ff51a200b76fadc46ea4efecc820e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0142489f1ffb8f97b2028daca0d9ff0da0f22cf0b8e87292e813c1d7623f43854f369f52f271114dc2a52ed8085f38ac46d6cd2b240b5d248dc248983562c36
|
7
|
+
data.tar.gz: 9f35c6f776868792edd6f1109232fa506f86e2c6c623379f7b36f7f61a40414367919bb50ca5f23c4bcdb0cb197ea722a8b65ce9da7d911b11bf306dcd293347
|
data/.gitignore
CHANGED
data/lib/wegift/client.rb
CHANGED
@@ -7,6 +7,7 @@ require_relative 'models/product'
|
|
7
7
|
require_relative 'models/products'
|
8
8
|
require_relative 'models/order'
|
9
9
|
require_relative 'models/stock'
|
10
|
+
require_relative 'models/remote_code'
|
10
11
|
|
11
12
|
module Wegift
|
12
13
|
class Client
|
@@ -64,5 +65,10 @@ module Wegift
|
|
64
65
|
stock = Wegift::Stock.new(id: id)
|
65
66
|
stock.get(self)
|
66
67
|
end
|
68
|
+
|
69
|
+
def remote_code(url)
|
70
|
+
code = Wegift::RemoteCode.new(url: url)
|
71
|
+
code.get(self)
|
72
|
+
end
|
67
73
|
end
|
68
74
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'uri'
|
5
|
+
|
6
|
+
module Wegift
|
7
|
+
class RemoteCode < Response
|
8
|
+
attr_accessor :url
|
9
|
+
|
10
|
+
# response/success
|
11
|
+
attr_accessor :amount, :barcode_format, :barcode_string, :code, :expiry_date,
|
12
|
+
:pin, :type
|
13
|
+
|
14
|
+
def get(ctx)
|
15
|
+
parse(Faraday.get("#{url}?format=json"))
|
16
|
+
end
|
17
|
+
|
18
|
+
def parse(response)
|
19
|
+
super
|
20
|
+
|
21
|
+
if is_successful?
|
22
|
+
self.class.new(@payload['e_code'])
|
23
|
+
else
|
24
|
+
self
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/wegift/version.rb
CHANGED
data/wegift-ruby-client.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
27
27
|
spec.add_development_dependency 'byebug', '~> 11'
|
28
28
|
spec.add_development_dependency 'dotenv', '~> 2.2', '>= 2.2.0'
|
29
|
-
spec.add_development_dependency
|
29
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
31
|
spec.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.3'
|
32
32
|
spec.add_development_dependency 'webmock', '~> 3.5', '>= 3.5.0'
|
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.
|
4
|
+
version: 1.10.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: 2022-
|
11
|
+
date: 2022-04-26 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,26 +82,29 @@ 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
|
104
104
|
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '12.3'
|
105
108
|
- - ">="
|
106
109
|
- !ruby/object:Gem::Version
|
107
110
|
version: 12.3.3
|
@@ -109,6 +112,9 @@ dependencies:
|
|
109
112
|
prerelease: false
|
110
113
|
version_requirements: !ruby/object:Gem::Requirement
|
111
114
|
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '12.3'
|
112
118
|
- - ">="
|
113
119
|
- !ruby/object:Gem::Version
|
114
120
|
version: 12.3.3
|
@@ -150,22 +156,22 @@ dependencies:
|
|
150
156
|
name: webmock
|
151
157
|
requirement: !ruby/object:Gem::Requirement
|
152
158
|
requirements:
|
153
|
-
- - ">="
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: 3.5.0
|
156
159
|
- - "~>"
|
157
160
|
- !ruby/object:Gem::Version
|
158
161
|
version: '3.5'
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 3.5.0
|
159
165
|
type: :development
|
160
166
|
prerelease: false
|
161
167
|
version_requirements: !ruby/object:Gem::Requirement
|
162
168
|
requirements:
|
163
|
-
- - ">="
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: 3.5.0
|
166
169
|
- - "~>"
|
167
170
|
- !ruby/object:Gem::Version
|
168
171
|
version: '3.5'
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 3.5.0
|
169
175
|
description:
|
170
176
|
email:
|
171
177
|
- klaas.endrikat@googlemail.com
|
@@ -191,6 +197,7 @@ files:
|
|
191
197
|
- lib/wegift/models/order.rb
|
192
198
|
- lib/wegift/models/product.rb
|
193
199
|
- lib/wegift/models/products.rb
|
200
|
+
- lib/wegift/models/remote_code.rb
|
194
201
|
- lib/wegift/models/response.rb
|
195
202
|
- lib/wegift/models/stock.rb
|
196
203
|
- lib/wegift/version.rb
|
@@ -214,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
221
|
- !ruby/object:Gem::Version
|
215
222
|
version: '0'
|
216
223
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
224
|
+
rubygems_version: 3.2.3
|
218
225
|
signing_key:
|
219
226
|
specification_version: 4
|
220
227
|
summary: A simple Ruby client for the WEGIFT API
|