vauchar_api 0.2.2 → 0.2.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9732931f29c0f4fbbe2c9caeaaee8ee0aca00de9c44fc1f23f6d6c6b20cbee83
|
4
|
+
data.tar.gz: 72b93f759f8fd53d2b1e21b1e73ba1c686555ffcb241be269da2006ad56c6dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ede2c68ac32e38d3fce3baf04a085c77b7381cfb3c5613d6c7fdfde449ec00f6d1460c09d72ee6cadd2640c680ce2b0772a8e5a8272599a6d28ca80a611b11d6
|
7
|
+
data.tar.gz: 84e3642b106fb45c53be8d66234a611ce927e08bd307898733554a7745d08aa51c6a2c56aaabf5b66b738eed2d577fd2c78a5f01e1a3ad56e4495447d74915ec
|
@@ -1,8 +1,11 @@
|
|
1
1
|
module ActiveResource
|
2
2
|
module Formats
|
3
3
|
def self.remove_root(data)
|
4
|
-
|
5
|
-
|
4
|
+
begin
|
5
|
+
data = data.with_indifferent_access
|
6
|
+
data = data.key?(:data) ? data[:data] : data
|
7
|
+
rescue
|
8
|
+
end
|
6
9
|
p "Formats==================================="
|
7
10
|
p data
|
8
11
|
p "=========================================="
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module VaucharAPI
|
2
|
+
# ==== Examples
|
3
|
+
#
|
4
|
+
# Create
|
5
|
+
# new_list = VaucharAPI::List.new(name: "max list", brand_id: "brn-15507182295c6e1515a956a")
|
6
|
+
# new_list.save
|
7
|
+
#
|
8
|
+
# Read
|
9
|
+
# list = VaucharAPI::List.find("list-15508273755c6fbf6fc8ac7")
|
10
|
+
# redemptions = VaucharAPI::DealRedemption.all
|
11
|
+
#
|
12
|
+
# Update
|
13
|
+
# list = VaucharAPI::List.find("list-15508273755c6fbf6fc8ac7")
|
14
|
+
# list.name = "Max update"
|
15
|
+
# list.save
|
16
|
+
#
|
17
|
+
# Delete
|
18
|
+
# list = VaucharAPI::List.find("list-15508273755c6fbf6fc8ac7")
|
19
|
+
# list.destroy
|
20
|
+
#
|
21
|
+
# Customers
|
22
|
+
# list = VaucharAPI::List.find("list-15502036875c663b27600fe")
|
23
|
+
# list.get(:customers);
|
24
|
+
#
|
25
|
+
# Add Customers
|
26
|
+
# list = VaucharAPI::List.find("list-15502036875c663b27600fe")
|
27
|
+
# list.post(:customers, {}, {customers: ["cust-15508280955c6fc23f7f807", "cust-15507323535c6e4c416c697"]}.to_json)
|
28
|
+
#
|
29
|
+
# Delete Customers
|
30
|
+
# list = VaucharAPI::List.find("list-15502036875c663b27600fe")
|
31
|
+
# list.delete(:customers, {}, {customers: ["cust-15508280955c6fc23f7f807", "cust-15507323535c6e4c416c697"]})
|
32
|
+
#
|
33
|
+
# Find By Brand
|
34
|
+
# lists = VaucharAPI::List.find(:all, params: {brand_id: "brn-15507182295c6e1515a956a"})
|
35
|
+
|
36
|
+
class DealRedemption < Base
|
37
|
+
self.prefix = "/engage/"
|
38
|
+
self.element_name = "deals/redemptions"
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module VaucharAPI
|
2
|
+
# redemption = VaucharAPI::VoucherRedemption.find({voucher_id: "vcr-15533454515c962bab95e5b"})
|
3
|
+
# redemption[:id]
|
4
|
+
class VoucherRedemption < Base
|
5
|
+
self.element_name = "vouchers"
|
6
|
+
|
7
|
+
def self.find(params)
|
8
|
+
resource = get("#{params[:voucher_id]}/redemptions", {})
|
9
|
+
resource.first.with_indifferent_access
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.destroy(params)
|
13
|
+
begin
|
14
|
+
redemption = VaucharAPI::VoucherRedemption.find({voucher_id: params[:voucher_id]})
|
15
|
+
p redemption[:id]
|
16
|
+
resource = delete("#{params[:voucher_id]}/redemptions/#{redemption[:id]}")
|
17
|
+
rescue
|
18
|
+
p "destroy fail!!"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/vauchar_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vauchar_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,9 +81,12 @@ files:
|
|
81
81
|
- lib/vauchar_api/resources/customer.rb
|
82
82
|
- lib/vauchar_api/resources/customer_deal.rb
|
83
83
|
- lib/vauchar_api/resources/deal.rb
|
84
|
+
- lib/vauchar_api/resources/deal_redemption.rb
|
84
85
|
- lib/vauchar_api/resources/list.rb
|
85
86
|
- lib/vauchar_api/resources/team.rb
|
86
87
|
- lib/vauchar_api/resources/verify_credentials.rb
|
88
|
+
- lib/vauchar_api/resources/voucher.rb
|
89
|
+
- lib/vauchar_api/resources/voucher_redemption.rb
|
87
90
|
- lib/vauchar_api/version.rb
|
88
91
|
- vauchar_api-0.1.3.gem
|
89
92
|
- vauchar_api.gemspec
|