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 +4 -4
- data/lib/vk_api_simple/market/add.rb +11 -0
- data/lib/vk_api_simple/market.rb +20 -0
- data/lib/vk_api_simple/photos/save_market_photo.rb +1 -1
- data/lib/vk_api_simple/version.rb +1 -1
- data/lib/vk_api_simple.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e73d114cd08600bd2db7f11bdf228049eb1eb72d1e3c24bba6398171dcef753
|
4
|
+
data.tar.gz: df43876f3341bbb4c5af467ea530206a0700e4f84ec7ad1b284ed586374dd176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/vk_api_simple.rb
CHANGED
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.
|
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
|