tangolicious 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tangolicious/catalog.rb +2 -2
- data/lib/tangolicious/order.rb +2 -2
- data/lib/tangolicious/request.rb +9 -2
- data/lib/tangolicious/resource.rb +2 -2
- data/lib/tangolicious/version.rb +1 -1
- data/tangolicious.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 463a5efbf10d80f8e7f18f0a19922f6c40c5cf85
|
4
|
+
data.tar.gz: aac137d00c44f2a9cb1569bd54da1221406dbd21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ccbb758512cd5b2ec13a3fd700a8ada9a4d16fd90ce590488747377bab81ddf4a95283702c725b49c62ceca3979be86db8ca83a6bf4ded5c3d0fb589cd2469
|
7
|
+
data.tar.gz: ad4cec1b27e120e80efcb65ca3dbdbf0b5dee3e08a52784c89c704bf6a6878eb5b0411b42fc1bd5431ea2552281fa2622fb47f29d6d1989ecad3fa5d83cf0af0
|
data/lib/tangolicious/catalog.rb
CHANGED
@@ -3,8 +3,8 @@ require 'tangolicious/resource'
|
|
3
3
|
|
4
4
|
module Tangolicious
|
5
5
|
class Catalog < Resource
|
6
|
-
def self.list
|
7
|
-
response = request.get(endpoint)
|
6
|
+
def self.list(params = {})
|
7
|
+
response = request.get(endpoint, params)
|
8
8
|
{ brands: Brand.wrap(response['brands']), catalog_name: response['catalogName'] }
|
9
9
|
end
|
10
10
|
|
data/lib/tangolicious/order.rb
CHANGED
@@ -3,8 +3,8 @@ require 'tangolicious/resource'
|
|
3
3
|
|
4
4
|
module Tangolicious
|
5
5
|
class Order < Resource
|
6
|
-
def self.list
|
7
|
-
response = request.get(endpoint)
|
6
|
+
def self.list(params = {})
|
7
|
+
response = request.get(endpoint, params)
|
8
8
|
{ page: response['page'], orders: self.wrap(response['orders']) }
|
9
9
|
end
|
10
10
|
|
data/lib/tangolicious/request.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'active_support/inflector'
|
3
|
+
require 'addressable/uri'
|
3
4
|
require 'tangolicious/util'
|
4
5
|
require 'tangolicious/exceptions'
|
5
6
|
|
@@ -7,8 +8,8 @@ module Tangolicious
|
|
7
8
|
class Request
|
8
9
|
include Util
|
9
10
|
|
10
|
-
def get(endpoint)
|
11
|
-
response = parsed_response(HTTParty.get("#{Tangolicious.api_base}#{endpoint}",
|
11
|
+
def get(endpoint, params = {})
|
12
|
+
response = parsed_response(HTTParty.get("#{Tangolicious.api_base}#{endpoint}?#{query_string(params)}",
|
12
13
|
basic_auth: basic_auth))
|
13
14
|
check_errors(response)
|
14
15
|
end
|
@@ -23,6 +24,12 @@ module Tangolicious
|
|
23
24
|
|
24
25
|
private
|
25
26
|
|
27
|
+
def query_string(params)
|
28
|
+
uri = Addressable::URI.new
|
29
|
+
uri.query_values = camelize_keys(params)
|
30
|
+
uri.query
|
31
|
+
end
|
32
|
+
|
26
33
|
def check_errors(response)
|
27
34
|
return response if response.is_a?(Array)
|
28
35
|
raise Exceptions::BadRequest.new(response) if response.fetch('httpCode', nil) == 400
|
data/lib/tangolicious/version.rb
CHANGED
data/tangolicious.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tangolicious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: addressable
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description:
|
112
126
|
email:
|
113
127
|
- aaron@bonus.ly
|