vk_api_simple 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 846cc24a8cc83a7368518f0431eda89c2733a2bf425788837e9cfd9d7946e663
4
- data.tar.gz: e4a97dc5d41191a85549f4b589d05f17bed4f6a8e54cb65c9701d5a04ceaefdf
3
+ metadata.gz: 4e73d114cd08600bd2db7f11bdf228049eb1eb72d1e3c24bba6398171dcef753
4
+ data.tar.gz: df43876f3341bbb4c5af467ea530206a0700e4f84ec7ad1b284ed586374dd176
5
5
  SHA512:
6
- metadata.gz: edfa6bba803f372ee0287c9c6658f7364ea96d49b9e2d44b533bd05d08187bf1be0b361e674d052887988d6c0f260136d8719d616437082c0ecfd65fa71f9ba9
7
- data.tar.gz: d5c61d4edb61d1858b4f42f177c26a8e6b2f0ba245d2b6b2999ce04b4775955f03c476bcd00bdd009f9d2367bf84f33ec72589badbaf506ab5b6ef1a01322dde
6
+ metadata.gz: 7ea18c18eb131b3c0bae43e1f8bab4939a9fab796da92f8fe94e047941d41a2608c057cbe3f8e9de89026082c8d2d89695791aa8e997219f1b3e2e7c603a90a0
7
+ data.tar.gz: ff90b4601cbb2f8a660e68c1571b29bb59fd30c0993c6678392969889d04aba183c867f489f0adbad193ae6bc9517c4520a0658148ab556823c217c69895a934
@@ -0,0 +1,11 @@
1
+ module VkApiSimple
2
+ class Market
3
+ # Save uploaded image at server
4
+ module Add
5
+ def add(args = {})
6
+ response = RestClient.post("#{BASE_URI}save?access_token=#{token}&owner_id=-#{args[:owner_id]}&category_id=#{args[:category_id]}&price=#{args[:price]}&main_photo_id=#{args[:main_photo_id]}&v=#{api_version}", name: args[:name], description: args[:description])
7
+ JSON.parse(response.body)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+ require_relative 'market/add'
4
+
5
+ module VkApiSimple
6
+ # Market requests
7
+ class Market
8
+ include VkApiSimple::Market::Add
9
+
10
+ BASE_URI = 'https://api.vk.com/method/market.'.freeze
11
+ VK_API_VERSION = '5.74'.freeze
12
+
13
+ attr_reader :token, :api_version
14
+
15
+ def initialize(args = {})
16
+ @token = args[:token]
17
+ @api_version = args[:api_version] || VK_API_VERSION
18
+ end
19
+ end
20
+ end
@@ -3,7 +3,7 @@ module VkApiSimple
3
3
  # Save uploaded image at server
4
4
  module SaveMarketPhoto
5
5
  def save_market_photo(args = {})
6
- response = RestClient.post("#{BASE_URI}saveMarketPhoto?access_token=#{token}&group_id=#{args[:group_id]}&server=#{args[:server]}&photo=#{args[:photo]}&hash=#{args[:hash]}&crop_data=#{args[:crop_data]}&crop_hash=#{args[:crop_hash]}&v=#{api_version}")
6
+ response = RestClient.post("#{BASE_URI}saveMarketPhoto?access_token=#{token}&group_id=#{args[:group_id]}&server=#{args[:server]}&photo=#{args[:photo]}&hash=#{args[:hash]}&crop_data=#{args[:crop_data]}&crop_hash=#{args[:crop_hash]}&v=#{api_version}", {})
7
7
  JSON.parse(response.body)
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module VkApiSimple
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
data/lib/vk_api_simple.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require_relative 'vk_api_simple/version'
2
2
  require_relative 'vk_api_simple/photos'
3
+ require_relative 'vk_api_simple/market'
3
4
 
4
5
  # Base module
5
6
  module VkApiSimple
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vk_api_simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kortirso
@@ -99,6 +99,8 @@ files:
99
99
  - bin/console
100
100
  - bin/setup
101
101
  - lib/vk_api_simple.rb
102
+ - lib/vk_api_simple/market.rb
103
+ - lib/vk_api_simple/market/add.rb
102
104
  - lib/vk_api_simple/photos.rb
103
105
  - lib/vk_api_simple/photos/get_market_upload_server.rb
104
106
  - lib/vk_api_simple/photos/get_upload_server.rb