FlipkartSeller 0.0.2 → 0.0.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
  SHA1:
3
- metadata.gz: 6a75384fdb3b28525209a333605a44e3d6e1911c
4
- data.tar.gz: 40e405804559f264753bb620e633ba82d144e6d9
3
+ metadata.gz: ed3944115ca9e98ba43081d9705140201ef44edc
4
+ data.tar.gz: 7af51e807608ada6be25a4d338976d6b414e24d8
5
5
  SHA512:
6
- metadata.gz: 045bd603db444c39e68d8273c003c512968a0cf03ef5d356a56f0058bb00288fac16a28e3ff0e03f0c3387166bc68138a4deb41385e97f8186853c43e5249c22
7
- data.tar.gz: 1ba48d1f1746e05ef9e8db756fc103e4f60af9d609c261f1937133dc9101000ba40f01467bc54e7af19d817e0502f8536f13615d49e932c248b2e7857278abaa
6
+ metadata.gz: 916b95e8a0bb10ccfc38af7f46664026fb19ccf854bab483974fe2a172ae7fd56e9519cdfd9289c8224d5d4c511a6adeca97ef25768c627e3b887a005d801853
7
+ data.tar.gz: 2e39dc22a358ac123386223e24ed046ea53e56fb83b7f65749cd456e090486b24218d99bd6a5cadb3539268dec5a7305a986bdc897a20087ea6d7f866b857110
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # FlipkartSeller
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/FlipkartSeller`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Ruby Gem for Flipkart Marketplace API.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ This extension helps developers to integrate Flipkart marketplace API easily in Rails application.
6
6
 
7
7
  ## Installation
8
8
 
@@ -14,7 +14,7 @@ gem 'FlipkartSeller'
14
14
 
15
15
  And then execute:
16
16
 
17
- $ bundle
17
+ $ bundle install
18
18
 
19
19
  Or install it yourself as:
20
20
 
@@ -22,17 +22,17 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ 1. Create flipkart client object
26
26
 
27
- ## Development
27
+ fk_client = FlipkartSeller::Client.new(CLIENT_ID,CLIENT_SECRET)
28
28
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+ 2. Fetch your orders
30
30
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+ fk_client.fetch_orders
32
32
 
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/FlipkartSeller. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
33
+ 3. Get product detail
34
+
35
+ fk_client.get_product(PRODUCT_SKU)
36
36
 
37
37
 
38
38
  ## License
@@ -1,7 +1,7 @@
1
1
  module FlipkartSeller
2
2
  class Base
3
3
  include Order
4
-
4
+ include Product
5
5
  attr_reader :access_token
6
6
  attr_reader :environemnt
7
7
  attr_reader :base_url
@@ -0,0 +1,72 @@
1
+ module FlipkartSeller
2
+ module Product
3
+
4
+ def get_product(sku)
5
+
6
+ begin
7
+
8
+ response = RestClient::Request.execute(
9
+ :method => :get,
10
+ :url => "#{@base_url}/sellers/skus/#{sku}/listings",
11
+ :headers => {'Authorization' => 'Bearer ' + @access_token, :content_type => 'application/json'}
12
+ )
13
+
14
+ if response.code == 200
15
+ response_data = JSON.parse(response.body)
16
+
17
+ return response_data
18
+ end
19
+
20
+ rescue Exception => e
21
+ Rails.logger.error e.message
22
+ end
23
+
24
+ end
25
+
26
+ def update_product(sku,data)
27
+
28
+ begin
29
+
30
+ response = RestClient::Request.execute(
31
+ :method => :post,
32
+ :url => "#{@base_url}/sellers/skus/#{sku}/listings",
33
+ :headers => {'Authorization' => 'Bearer ' + @access_token, :content_type => 'application/json'},
34
+ :payload=> "#{data.to_json}"
35
+ )
36
+
37
+ if response.code == 200
38
+ response_data = JSON.parse(response.body)
39
+
40
+ return response_data
41
+ end
42
+
43
+ rescue Exception => e
44
+ Rails.logger.error e.message
45
+ end
46
+
47
+ end
48
+
49
+ def update_products(data)
50
+
51
+ begin
52
+
53
+ response = RestClient::Request.execute(
54
+ :method => :post,
55
+ :url => "#{BASE_URL}/sellers/skus/listings/bulk",
56
+ :headers => {'Authorization' => 'Bearer ' + @access_token, :content_type => 'application/json'},
57
+ :payload=> "#{data.to_json}"
58
+ )
59
+
60
+ if response.code == 200
61
+ response_data = JSON.parse(response.body)
62
+
63
+ return response_data
64
+ end
65
+
66
+ rescue Exception => e
67
+ Rails.logger.error e.message
68
+ end
69
+
70
+ end
71
+ end
72
+ end
@@ -1,3 +1,3 @@
1
1
  module FlipkartSeller
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require "FlipkartSeller/version"
2
2
  require "FlipkartSeller/order"
3
+ require "FlipkartSeller/product"
3
4
  require "FlipkartSeller/base"
4
5
  require "FlipkartSeller/client"
5
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: FlipkartSeller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atish Kumar Sahoo
@@ -91,6 +91,7 @@ files:
91
91
  - lib/FlipkartSeller/base.rb
92
92
  - lib/FlipkartSeller/client.rb
93
93
  - lib/FlipkartSeller/order.rb
94
+ - lib/FlipkartSeller/product.rb
94
95
  - lib/FlipkartSeller/version.rb
95
96
  homepage: https://gitlab.com/AtishSahoo/FlipkartSeller
96
97
  licenses: