runa-ruby-client 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/runa/models/order.rb +2 -1
- data/lib/runa/models/product.rb +34 -4
- data/lib/runa/models/products.rb +20 -5
- data/lib/runa/version.rb +1 -1
- data/lib/runa.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f58ae1f4737c912a016aee86c8fc1f2fa9c13688b60ce8cf6fba2f6bf49edc2
|
|
4
|
+
data.tar.gz: a6cc0c93b057d80f3c304f5e72f0a281dea7263b627d13e5702699b0b37e41bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53a854ec2de09869975548965c68c459f8cf6fdf9af52a1eb7e68ab6ece3541cb14fe04a3bf28e7afdfb9d0a4f6382fba0d3b3d6c88aacb1dda4857ff6a5127c
|
|
7
|
+
data.tar.gz: a7086b74764d17849a718c19d4e64e26d8045a9d12297e011ffd18d417e67d013b629dd41635b8b9342fa3db026acfdeae1098082934736e1ac5cfd183bd167f
|
data/lib/runa/models/order.rb
CHANGED
|
@@ -10,7 +10,7 @@ class Runa::Order < Runa::Response
|
|
|
10
10
|
attr_accessor :payment_type, :currency, :face_value, :distribution_type, :product_code, :external_ref
|
|
11
11
|
|
|
12
12
|
# response/success
|
|
13
|
-
attr_accessor :code, :order_id, :status, :created_at, :payment_method, :currency, :total_price,
|
|
13
|
+
attr_accessor :code, :order_id, :status, :created_at, :payment_method, :currency, :total_price,
|
|
14
14
|
:total_discount, :items, :redemption_url, :order_id
|
|
15
15
|
|
|
16
16
|
def initialize(params = {})
|
|
@@ -69,6 +69,7 @@ class Runa::Order < Runa::Response
|
|
|
69
69
|
@status = @payload['status']
|
|
70
70
|
@total_price = @payload['total_price']
|
|
71
71
|
@items = @payload['items']
|
|
72
|
+
@redemption_url = @items.first['redemption_url']
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
@order_id = @payload['id']
|
data/lib/runa/models/product.rb
CHANGED
|
@@ -7,15 +7,45 @@ class Runa::Product < Runa::Response
|
|
|
7
7
|
attr_accessor :product_code
|
|
8
8
|
|
|
9
9
|
# response/success
|
|
10
|
-
attr_accessor :
|
|
11
|
-
:
|
|
10
|
+
attr_accessor :available_denominations,
|
|
11
|
+
:availability,
|
|
12
|
+
:card_image_url,
|
|
12
13
|
:categories,
|
|
13
|
-
:
|
|
14
|
+
:code,
|
|
15
|
+
:content_resources,
|
|
16
|
+
:countries_redeemable_in,
|
|
17
|
+
:currency,
|
|
18
|
+
:denomination_type,
|
|
19
|
+
:description_url,
|
|
20
|
+
:e_code_usage_type,
|
|
14
21
|
:gift_card,
|
|
15
|
-
:
|
|
22
|
+
:name,
|
|
23
|
+
:minimum_value,
|
|
24
|
+
:maximum_value,
|
|
25
|
+
:redeem_instructions_url,
|
|
26
|
+
:state,
|
|
27
|
+
:nonsense,
|
|
28
|
+
:terms_and_conditions_url
|
|
16
29
|
|
|
17
30
|
def initialize(params = {})
|
|
18
31
|
super
|
|
32
|
+
|
|
33
|
+
unless gift_card.nil?
|
|
34
|
+
denominations = gift_card['denominations']
|
|
35
|
+
@denomination_type = denominations['type']
|
|
36
|
+
@available_denominations = denominations['available_list']
|
|
37
|
+
@minimum_value = denominations['minimum_value']
|
|
38
|
+
@maximum_value = denominations['maximum_value']
|
|
39
|
+
@card_image_url = gift_card['assets']['card_image_url']
|
|
40
|
+
@e_code_usage_type = gift_card['e_code_usage_type']
|
|
41
|
+
|
|
42
|
+
@content_resources = gift_card['content_resources']
|
|
43
|
+
@description_url = @content_resources['description_markdown_url']
|
|
44
|
+
@redeem_instructions_url = @content_resources['redemption_instructions_markdown_url']
|
|
45
|
+
@terms_and_conditions_url = @content_resources['terms_consumer_markdown_url']
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
self
|
|
19
49
|
end
|
|
20
50
|
|
|
21
51
|
def path
|
data/lib/runa/models/products.rb
CHANGED
|
@@ -8,8 +8,24 @@ class Runa::Products < Runa::Response
|
|
|
8
8
|
# Product Details List
|
|
9
9
|
# GET /v2/product
|
|
10
10
|
def get(ctx)
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
@all = []
|
|
12
|
+
@after_key = nil
|
|
13
|
+
|
|
14
|
+
loop do
|
|
15
|
+
options = {}
|
|
16
|
+
if !@after_key.nil?
|
|
17
|
+
options = {
|
|
18
|
+
after: @after_key
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
response = ctx.request(:get, PATH, options, '')
|
|
22
|
+
parse(response)
|
|
23
|
+
if @after_key.nil?
|
|
24
|
+
break
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
self
|
|
13
29
|
end
|
|
14
30
|
|
|
15
31
|
# Find all products by fieldname.
|
|
@@ -23,12 +39,11 @@ class Runa::Products < Runa::Response
|
|
|
23
39
|
if is_successful?
|
|
24
40
|
# TODO: separate?
|
|
25
41
|
if @payload['catalog']
|
|
26
|
-
|
|
42
|
+
@all.concat(@payload['catalog'].map { |p| Runa::Product.new(p) })
|
|
27
43
|
end
|
|
44
|
+
@after_key = @payload['pagination']['cursors']['after']
|
|
28
45
|
else
|
|
29
46
|
@all = []
|
|
30
47
|
end
|
|
31
|
-
|
|
32
|
-
self
|
|
33
48
|
end
|
|
34
49
|
end
|
data/lib/runa/version.rb
CHANGED
data/lib/runa.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runa-ruby-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luke Oglesby
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-09-
|
|
11
|
+
date: 2024-09-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|