selly 1.1.2 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/selly.rb +3 -2
- data/lib/selly/blacklist.rb +10 -0
- data/lib/selly/coupons.rb +16 -0
- data/lib/selly/exchange_rates.rb +0 -0
- data/lib/selly/operations/create.rb +15 -10
- data/lib/selly/operations/list.rb +6 -1
- data/lib/selly/operations/show.rb +6 -1
- data/lib/selly/operations/update.rb +16 -0
- data/lib/selly/orders.rb +0 -0
- data/lib/selly/pay.rb +4 -5
- data/lib/selly/product_groups.rb +15 -5
- data/lib/selly/products.rb +10 -0
- data/lib/selly/resource.rb +1 -1
- data/lib/selly/selly_error.rb +7 -0
- data/lib/selly/version.rb +1 -1
- data/selly.gemspec +0 -0
- metadata +6 -5
- data/lib/selly/operations/destroy.rb +0 -11
- data/lib/selly/statistics.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 231d308af9ae1960f66c512426dea854dcb9d975
|
4
|
+
data.tar.gz: bb97594ca94e71a2d4bb1413b6439bbf601d7c12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b55c6f694bb5cbe8c56adf5ccca61bf26cc333bfdbd71de621f612193ec03af056426b05c3798941c59dbeb2a018fc48c13c152c74c89f022c0693e09159f495
|
7
|
+
data.tar.gz: 145d13778d8965aea2cd7cdcb89a39408f000b46072f7ac59f814675b141d099d060b7358f4734dc47c67179a218d1536d53ea0ef45424ba0d6e90b263e5139d
|
data/.gitignore
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/lib/selly.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'selly/version'
|
2
|
+
require 'selly/selly_error'
|
2
3
|
require 'selly/operations/create'
|
3
|
-
require 'selly/operations/destroy'
|
4
4
|
require 'selly/operations/list'
|
5
5
|
require 'selly/operations/show'
|
6
|
+
require 'selly/operations/update'
|
6
7
|
require 'selly/resource'
|
7
8
|
require 'selly/blacklist'
|
8
9
|
require 'selly/exchange_rates'
|
@@ -14,7 +15,7 @@ require 'selly/statistics'
|
|
14
15
|
require 'base64'
|
15
16
|
|
16
17
|
module Selly
|
17
|
-
API_ROOT = 'https://selly.gg/api'.freeze
|
18
|
+
API_ROOT = 'https://selly.gg/api/v2'.freeze
|
18
19
|
USER_AGENT = "[Selly Ruby v#{VERSION}] Ruby-#{RUBY_VERSION} - #{RUBY_PLATFORM}".freeze
|
19
20
|
JSON_MIME = 'application/json'.freeze
|
20
21
|
|
data/lib/selly/blacklist.rb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
module Selly
|
2
2
|
class Blacklist < Resource
|
3
3
|
extend Selly::Operations::List
|
4
|
+
extend Selly::Operations::Create
|
5
|
+
extend Selly::Operations::Update
|
6
|
+
|
7
|
+
def create(params)
|
8
|
+
super({blacklist: params})
|
9
|
+
end
|
10
|
+
|
11
|
+
def update(id, params)
|
12
|
+
super(id, {blacklist: params})
|
13
|
+
end
|
4
14
|
end
|
5
15
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Selly
|
2
|
+
class Coupons < Resource
|
3
|
+
extend Selly::Operations::List
|
4
|
+
extend Selly::Operations::Show
|
5
|
+
extend Selly::Operations::Create
|
6
|
+
extend Selly::Operations::Update
|
7
|
+
|
8
|
+
def create(params)
|
9
|
+
super({coupon: params})
|
10
|
+
end
|
11
|
+
|
12
|
+
def update(id, params)
|
13
|
+
super(id, {coupon: params})
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/selly/exchange_rates.rb
CHANGED
File without changes
|
@@ -1,11 +1,16 @@
|
|
1
|
-
require 'http'
|
2
|
-
|
3
|
-
module Selly
|
4
|
-
module Operations
|
5
|
-
module Create
|
6
|
-
def create(params = {})
|
7
|
-
HTTP.post("#{API_ROOT}#{resource_url}", headers: Selly.request_headers,
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
require 'http'
|
2
|
+
|
3
|
+
module Selly
|
4
|
+
module Operations
|
5
|
+
module Create
|
6
|
+
def create(params = {})
|
7
|
+
response = HTTP.post("#{API_ROOT}#{resource_url}", headers: Selly.request_headers, json: params)
|
8
|
+
|
9
|
+
parsed = response.parse
|
10
|
+
if parsed.class == Hash && (response.code < 200 || response.code > 300)
|
11
|
+
raise SellyError.new(parsed['errors']), parsed['message']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
11
16
|
end
|
@@ -4,7 +4,12 @@ module Selly
|
|
4
4
|
module Operations
|
5
5
|
module List
|
6
6
|
def list(options = {})
|
7
|
-
HTTP.get("#{API_ROOT}#{resource_url}", headers: Selly.request_headers, params: options)
|
7
|
+
response = HTTP.get("#{API_ROOT}#{resource_url}", headers: Selly.request_headers, params: options)
|
8
|
+
|
9
|
+
parsed = response.parse
|
10
|
+
if parsed.class == Hash && (response.code < 200 || response.code > 300)
|
11
|
+
raise SellyError.new(parsed['errors']), parsed['message']
|
12
|
+
end
|
8
13
|
end
|
9
14
|
end
|
10
15
|
end
|
@@ -4,7 +4,12 @@ module Selly
|
|
4
4
|
module Operations
|
5
5
|
module Show
|
6
6
|
def show(resource_id, options = {})
|
7
|
-
HTTP.get("#{API_ROOT}#{resource_url}/#{resource_id}", headers: Selly.request_headers, params: options)
|
7
|
+
response = HTTP.get("#{API_ROOT}#{resource_url}/#{resource_id}", headers: Selly.request_headers, params: options)
|
8
|
+
|
9
|
+
parsed = response.parse
|
10
|
+
if parsed.class == Hash && (response.code < 200 || response.code > 300)
|
11
|
+
raise SellyError.new(parsed['errors']), parsed['message']
|
12
|
+
end
|
8
13
|
end
|
9
14
|
end
|
10
15
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'http'
|
2
|
+
|
3
|
+
module Selly
|
4
|
+
module Operations
|
5
|
+
module Update
|
6
|
+
def update(resource_id, params = {})
|
7
|
+
response = HTTP.put("#{API_ROOT}#{resource_url}/#{resource_id}", headers: Selly.request_headers, json: params)
|
8
|
+
|
9
|
+
parsed = response.parse
|
10
|
+
if parsed.class == Hash && (response.code < 200 || response.code > 300)
|
11
|
+
raise SellyError.new(parsed['errors']), parsed['message']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/selly/orders.rb
CHANGED
File without changes
|
data/lib/selly/pay.rb
CHANGED
data/lib/selly/product_groups.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
-
module Selly
|
2
|
-
class ProductGroups < Resource
|
3
|
-
extend Selly::Operations::List
|
4
|
-
extend Selly::Operations::Show
|
5
|
-
|
1
|
+
module Selly
|
2
|
+
class ProductGroups < Resource
|
3
|
+
extend Selly::Operations::List
|
4
|
+
extend Selly::Operations::Show
|
5
|
+
extend Selly::Operations::Create
|
6
|
+
extend Selly::Operations::Update
|
7
|
+
|
8
|
+
def create(params)
|
9
|
+
super({product_group: params})
|
10
|
+
end
|
11
|
+
|
12
|
+
def update(id, params)
|
13
|
+
super(id, {product_group: params})
|
14
|
+
end
|
15
|
+
end
|
6
16
|
end
|
data/lib/selly/products.rb
CHANGED
@@ -2,5 +2,15 @@ module Selly
|
|
2
2
|
class Products < Resource
|
3
3
|
extend Selly::Operations::List
|
4
4
|
extend Selly::Operations::Show
|
5
|
+
extend Selly::Operations::Create
|
6
|
+
extend Selly::Operations::Update
|
7
|
+
|
8
|
+
def create(params)
|
9
|
+
super({product: params})
|
10
|
+
end
|
11
|
+
|
12
|
+
def update(id, params)
|
13
|
+
super(id, {product: params})
|
14
|
+
end
|
5
15
|
end
|
6
16
|
end
|
data/lib/selly/resource.rb
CHANGED
data/lib/selly/version.rb
CHANGED
data/selly.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Selly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -69,17 +69,18 @@ files:
|
|
69
69
|
- bin/setup
|
70
70
|
- lib/selly.rb
|
71
71
|
- lib/selly/blacklist.rb
|
72
|
+
- lib/selly/coupons.rb
|
72
73
|
- lib/selly/exchange_rates.rb
|
73
74
|
- lib/selly/operations/create.rb
|
74
|
-
- lib/selly/operations/destroy.rb
|
75
75
|
- lib/selly/operations/list.rb
|
76
76
|
- lib/selly/operations/show.rb
|
77
|
+
- lib/selly/operations/update.rb
|
77
78
|
- lib/selly/orders.rb
|
78
79
|
- lib/selly/pay.rb
|
79
80
|
- lib/selly/product_groups.rb
|
80
81
|
- lib/selly/products.rb
|
81
82
|
- lib/selly/resource.rb
|
82
|
-
- lib/selly/
|
83
|
+
- lib/selly/selly_error.rb
|
83
84
|
- lib/selly/version.rb
|
84
85
|
- selly.gemspec
|
85
86
|
homepage: https://selly.gg
|
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
version: '0'
|
104
105
|
requirements: []
|
105
106
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.6.
|
107
|
+
rubygems_version: 2.6.14
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: Ruby library for Selly's API
|
data/lib/selly/statistics.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module Selly
|
2
|
-
class Statistics < Resource
|
3
|
-
extend Selly::Operations::Show
|
4
|
-
|
5
|
-
def self.income(options = {})
|
6
|
-
self.show('/income', options)
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.day_income(options = {})
|
10
|
-
self.show('/day_income', options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.views(options = {})
|
14
|
-
self.show('/views', options)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|