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: a1f734f934042cff6ce23cbeeb4f82dbd29f3b792667610f76b0ae165324210e
4
- data.tar.gz: 899595b230a397e426b246eda775bf6ef41a39e6666c5a8aa2cd3452f09d0f32
3
+ metadata.gz: 9732931f29c0f4fbbe2c9caeaaee8ee0aca00de9c44fc1f23f6d6c6b20cbee83
4
+ data.tar.gz: 72b93f759f8fd53d2b1e21b1e73ba1c686555ffcb241be269da2006ad56c6dcb
5
5
  SHA512:
6
- metadata.gz: f1581ba5cfcbdff039f581b883ff14e554da1d6ec40cc2a6c3ee191824c705b3804b0cc3a5795a6aee0c7a919d47f9965ff2d47579266be9642a533a6a747faf
7
- data.tar.gz: 36ddaf90595ee286fd142e29ce5f9c1e769973a2f49984d5b79b50455a3c958835c7905e9b60d2f4af1de102dda20ee44bd43badf1bcb10c187458a9a5ae442d
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
- data = data.with_indifferent_access
5
- data = data.key?(:data) ? data[:data] : data
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,5 @@
1
+ module VaucharAPI
2
+ # vouchers = VaucharAPI::Voucher.all
3
+ class Voucher < Base
4
+ end
5
+ 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
@@ -1,3 +1,3 @@
1
1
  module VaucharAPI
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.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-21 00:00:00.000000000 Z
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