PaytmSeller 0.0.1 → 0.0.2
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/PaytmSeller.rb +2 -0
- data/lib/PaytmSeller/base.rb +1 -1
- data/lib/PaytmSeller/exception.rb +27 -0
- data/lib/PaytmSeller/product.rb +24 -0
- data/lib/PaytmSeller/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01f5da3a6847e96712d870f831b94dd3f18208ce
|
4
|
+
data.tar.gz: 32145d413565e6b4b4e290120299d4961045cd36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe42207033fd8a6acd5b2058813ec20e66c9f9a16a098843f138f361eb00da0c569dac36bc9eacd676894b9cd9a2aeb922967979b601c67a908b13d8e88f8003
|
7
|
+
data.tar.gz: 5de456f6c8fcbc5fc3e533ba4ce9883d0b96a7c82154679cd097680390a833e8ac02f2bcae53266e413cf8b3ce56416a49258c8cf0969f06e3c6f1c20e3a392a
|
data/lib/PaytmSeller.rb
CHANGED
data/lib/PaytmSeller/base.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
module PaytmSeller
|
2
|
+
|
3
|
+
class StandardException < StandardError; end
|
4
|
+
|
5
|
+
class Exception < StandardError
|
6
|
+
attr_reader :response
|
7
|
+
|
8
|
+
def initialize(response)
|
9
|
+
@response = response
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
#for 412 response
|
15
|
+
class InvalidDataException < Exception
|
16
|
+
def initialize(response)
|
17
|
+
super(response)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class OtherException < Exception
|
22
|
+
def initialize(response)
|
23
|
+
super(response)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module PaytmSeller
|
2
|
+
module Product
|
3
|
+
|
4
|
+
def update_products(data)
|
5
|
+
begin
|
6
|
+
url = @environment.eql?(:production) ? "https://catalogadmin.paytm.com/v1/merchant/#{@merchant_id}/product.json" : "https://catalogadmin-staging.paytm.com/v1/merchant/#{@merchant_id}/product.json"
|
7
|
+
|
8
|
+
response = RestClient::Request.execute(method: :post, url: url,timeout: 10, headers: {:content_type => 'application/json', params: {"authtoken" => @access_token}}, payload: data.to_json)
|
9
|
+
|
10
|
+
response_data = JSON.parse(response.body)
|
11
|
+
|
12
|
+
return response_data
|
13
|
+
rescue RestClient::ExceptionWithResponse => e
|
14
|
+
raise StandardException.new if e.response.blank?
|
15
|
+
|
16
|
+
if e.response.code.present? && 412 == e.response.code
|
17
|
+
raise InvalidDataException.new(e.response), e.message
|
18
|
+
else
|
19
|
+
raise OtherException.new(e.response), e.message
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/PaytmSeller/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PaytmSeller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Atish Kumar Sahoo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,7 +88,9 @@ files:
|
|
88
88
|
- lib/PaytmSeller.rb
|
89
89
|
- lib/PaytmSeller/base.rb
|
90
90
|
- lib/PaytmSeller/client.rb
|
91
|
+
- lib/PaytmSeller/exception.rb
|
91
92
|
- lib/PaytmSeller/order.rb
|
93
|
+
- lib/PaytmSeller/product.rb
|
92
94
|
- lib/PaytmSeller/version.rb
|
93
95
|
homepage: https://github.com/atish-sahoo/PaytmSeller
|
94
96
|
licenses:
|