lmb-developers 1.2.1 → 1.2.5

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: ee0aea7fb87dfe34de9c21857538424cc44d58377ce29dbf4d07f40f552092bf
4
- data.tar.gz: a484949de0077fd2a807469cb8d5bf450303d576d0d6800a6307214a42359c84
3
+ metadata.gz: c041717903419dce19db99de43a58f72f0cb20924f47282b026ab58d71cb151b
4
+ data.tar.gz: b8f0184e994b1352542cd2587260bc5e2a3036aea3449ed9806e63e05a4427c1
5
5
  SHA512:
6
- metadata.gz: '072649dea80e6d3f28b5b4bb66bda45e715cea09f84db08d531074531a37b868d8e4ee03896bc81f89263ec31c16846b08e5684e355d78b935c279747a1fd429'
7
- data.tar.gz: e338f8dbe5648aa8c380137949654a4cd779f69f24579327b099ff1b5eb69704c41b6f797a07411046045430c1d4662f09926a437e40cb40a1527a97e2d19970
6
+ metadata.gz: f543c20e80be8b711b9df5f470b0b006b3a73e8dd307b7590d464f2eb2b39403b25af3de995c591d677d2355dfb5d8ecb1ac80aa5961805371e48a8074b0f89d
7
+ data.tar.gz: c6129fccfb03505e830f8f29e6130e4c5ffddbc0ad4edb8b65d9ec2ae0967a53b218777b38a665428e5b516945addb6f362a76eebad3971fca63a38b59b2f532
data/README.md CHANGED
@@ -26,6 +26,10 @@ Or install it yourself as:
26
26
 
27
27
  ### Configuration
28
28
 
29
+ To use the terminal use the following command:
30
+
31
+ $ irb -Ilib -rlmb/developers
32
+
29
33
  ```ruby
30
34
 
31
35
  # Pass environment and api_key to configure. Note: Use ENV variables to protect data in production environment
@@ -42,7 +46,7 @@ You will need an API KEY that can be obtained at [Leroy Merlin Brazil Developer'
42
46
  ```ruby
43
47
 
44
48
  #config/initilizers/lmb_developers.rb
45
- Lmb::Developers.configure('TEST', ENV['LMB_API_KEY'])
49
+ Lmb::Developers.configure('DEV', ENV['LMB_API_KEY'])
46
50
 
47
51
  #app/controller/login.rb
48
52
  Lmb::Developers::Auth.login("ldap_username", "ldap_password")
@@ -7,6 +7,7 @@ module Lmb
7
7
  VOUCHER_EXPIRED_PATH = '/v1/loyalty/voucher/expired'.freeze
8
8
  VOUCHER_PROVISIONED_PATH = '/v1/loyalty/voucher/provisioned'.freeze
9
9
  VOUCHER_ACTIVATED_PATH = '/v1/loyalty/voucher/activated'.freeze
10
+ SCORING_REDEMPTION_PATH = '/v1/loyalty/redemption'.freeze
10
11
 
11
12
  # Set Inhabitant's Expired Vouchers.
12
13
  #
@@ -81,6 +82,56 @@ module Lmb
81
82
  def self.configuration
82
83
  @configuration = Lmb::Developers.configuration
83
84
  end
85
+
86
+ def self.redemption(redemptions)
87
+ puts "-"*25
88
+ puts "entrou no metodo"
89
+ puts "-"*25
90
+ uri = URI.parse("#{configuration.url}#{SCORING_REDEMPTION_PATH}")
91
+ puts "-"*25
92
+ puts uri = URI.parse("#{configuration.url}#{SCORING_REDEMPTION_PATH}")
93
+ puts "-"*25
94
+ request = Net::HTTP::Post.new(uri)
95
+ puts "-"*25
96
+ puts request = Net::HTTP::Post.new(uri)
97
+ puts "-"*25
98
+ request['Apikey'] = configuration.api_key.to_s
99
+ puts "-"*25
100
+ puts request['Apikey'] = configuration.api_key.to_s
101
+ puts "-"*25
102
+ request['Cache-Control'] = 'no-cache'
103
+ puts "-"*25
104
+ puts request['Cache-Control'] = 'no-cache'
105
+ puts "-"*25
106
+ request.body = redemptions
107
+ puts "-"*25
108
+ puts request.body = redemptions
109
+ puts "-"*25
110
+ req_options = {
111
+ use_ssl: uri.scheme == 'https'
112
+ }
113
+ puts "-"*25
114
+ puts req_options = {
115
+ use_ssl: uri.scheme == 'https'
116
+ }
117
+ puts "-"*25
118
+ response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
119
+ http.request(request)
120
+ end
121
+ puts "-"*25
122
+ puts response.code.to_i
123
+ puts "-"*25
124
+ response.code.to_i == 202
125
+ rescue StandardError => exception
126
+ puts "-"*25
127
+ puts "-"*25
128
+ puts "-"*25
129
+ puts exception.message
130
+ puts "-"*25
131
+ puts "-"*25
132
+ puts "-"*25
133
+ exception
134
+ end
84
135
  end
85
136
  end
86
137
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'lmb-developers'
3
- s.version = '1.2.1'
3
+ s.version = '1.2.5'
4
4
  s.date = '2019-05-19'
5
5
  s.summary = "Consume APIs at Leroy Merlin Brazil Developer's Portal"
6
6
  s.description = "Gem to consume APIs available at Leroy Merlin Brazil Developer's Portal https://developers.leroymerlin.com.br"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lmb-developers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - PRTE - Tecnologia e Soluções
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
- rubygems_version: 3.0.2
49
+ rubygems_version: 3.1.2
50
50
  signing_key:
51
51
  specification_version: 4
52
52
  summary: Consume APIs at Leroy Merlin Brazil Developer's Portal