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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a19a42061cf3ca4d92ad3f387c0209224d3bfb96
4
- data.tar.gz: ccc45eaebde3731b4147c19eb0af6429760cf7d4
3
+ metadata.gz: 463a5efbf10d80f8e7f18f0a19922f6c40c5cf85
4
+ data.tar.gz: aac137d00c44f2a9cb1569bd54da1221406dbd21
5
5
  SHA512:
6
- metadata.gz: b8b971f9cdc40e87e8ca04272317c26a680c9dfdfe71383de9167ad189ee78c350ee2bb60c58c1da979155256e0288f0718d834699fe96e395e000cb545cf522
7
- data.tar.gz: c9c358ac3a45e1a378646432cf04f3037b264e016408a7f0391c3d5f4bc28588082a9ef0cdb0f2b76a94423c26b1c21de4a41d965ea1de6cd5899d64ec70897b
6
+ metadata.gz: 83ccbb758512cd5b2ec13a3fd700a8ada9a4d16fd90ce590488747377bab81ddf4a95283702c725b49c62ceca3979be86db8ca83a6bf4ded5c3d0fb589cd2469
7
+ data.tar.gz: ad4cec1b27e120e80efcb65ca3dbdbf0b5dee3e08a52784c89c704bf6a6878eb5b0411b42fc1bd5431ea2552281fa2622fb47f29d6d1989ecad3fa5d83cf0af0
@@ -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
 
@@ -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
 
@@ -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
@@ -11,8 +11,8 @@ module Tangolicious
11
11
  resources.map { |resource| new(resource) }
12
12
  end
13
13
 
14
- def self.list
15
- wrap(request.get(endpoint))
14
+ def self.list(params = {})
15
+ wrap(request.get(endpoint, params))
16
16
  end
17
17
 
18
18
  def self.retrieve(id)
@@ -1,3 +1,3 @@
1
1
  module Tangolicious
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'
3
3
  end
data/tangolicious.gemspec CHANGED
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_runtime_dependency 'activesupport'
30
30
  spec.add_runtime_dependency 'httparty'
31
+ spec.add_runtime_dependency 'addressable'
31
32
  end
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.0
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-06-19 00:00:00.000000000 Z
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