pactas_itero 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47ede807d9f024bbe91fe7e02c664c4cb37a91a3d3ed7e1d95e976ddb1f78c9f
4
- data.tar.gz: 78e54d2380a7f3fa107f8efcbefb78aa3f8769cc3a5953e61dcad30fc5cb65a2
3
+ metadata.gz: 1c640237f33f075e2b01065f84283d9a8c68a95badd3816ee0aaa908401037b8
4
+ data.tar.gz: b373eb25ecad679c10529e6072b15757a39c4bd33337784cba586b4ad1ae163d
5
5
  SHA512:
6
- metadata.gz: cea919a09293ade0837cfdffb9dcb31a675c4ee0c3b33b38542a71b66760d308beb8ae888935a7d9cd0fbf6bcc60c2da6451c6a1e721d298fd8ec74d0504441f
7
- data.tar.gz: 3071aec00f907381d62695962f2548338de436467ba08b4fc59b14987fd2aa6c41c91aad1677dd74d11fc8652c54544fe483c50eaae6f105cdabe694b031b9e4
6
+ metadata.gz: f5b1565b63af992bbc298f3113d0abc997a6fc0e475181edd03be4d1043273da6cdaa9b5b5a825be245ab836ce3ba2ba24badae369436c941b5b0a3c651844a0
7
+ data.tar.gz: f425d601137f812f8468de3484c9fc4754901db3bedba5b342a755b2924dae92b6dd19263e90e6ba25ec17f527055d3cea799836028a3e619a04a14795bace36
data/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## [UNRELEASED]
2
- ### Added
3
2
 
3
+ ### Added
4
4
  ### Changed
5
5
 
6
6
  ### Deprecated
@@ -11,6 +11,24 @@
11
11
 
12
12
  ### Security
13
13
 
14
+ ## [0.7.0] - 2022-02-22
15
+
16
+ ### Added
17
+
18
+ - get contract_changes
19
+
20
+ ### Changed
21
+
22
+ - Set required ruby version to >= 2.6
23
+ - Replace Travis CI with CircleCI
24
+ - `rubocop` version is specified to be `~> 1.8.1`
25
+ - `performance` version is specified to be `~> 1.7.0`
26
+
27
+ ### Removed
28
+
29
+ - Drop support for Ruby <= 2.5
30
+ - Drop support for JRuby
31
+
14
32
  ## [0.6.0] - 2021-03-03
15
33
  ### Changed
16
34
  - `faraday_middleware` version is specified to be `>= 1.0.0`
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in pactas_itero.gemspec
4
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,92 +1,112 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pactas_itero (0.5.0)
4
+ pactas_itero (0.7.0)
5
5
  faraday_middleware (>= 1.0)
6
6
  rash_alt
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.7.0)
11
+ addressable (2.8.0)
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.4.2)
14
14
  crack (0.4.5)
15
15
  rexml
16
- diff-lcs (1.4.4)
17
- docile (1.3.5)
18
- faraday (1.3.0)
16
+ diff-lcs (1.5.0)
17
+ docile (1.4.0)
18
+ faraday (1.10.0)
19
+ faraday-em_http (~> 1.0)
20
+ faraday-em_synchrony (~> 1.0)
21
+ faraday-excon (~> 1.1)
22
+ faraday-httpclient (~> 1.0)
23
+ faraday-multipart (~> 1.0)
19
24
  faraday-net_http (~> 1.0)
25
+ faraday-net_http_persistent (~> 1.0)
26
+ faraday-patron (~> 1.0)
27
+ faraday-rack (~> 1.0)
28
+ faraday-retry (~> 1.0)
29
+ ruby2_keywords (>= 0.0.4)
30
+ faraday-em_http (1.0.0)
31
+ faraday-em_synchrony (1.0.0)
32
+ faraday-excon (1.1.0)
33
+ faraday-httpclient (1.0.1)
34
+ faraday-multipart (1.0.3)
20
35
  multipart-post (>= 1.2, < 3)
21
- ruby2_keywords
22
36
  faraday-net_http (1.0.1)
23
- faraday_middleware (1.0.0)
37
+ faraday-net_http_persistent (1.2.0)
38
+ faraday-patron (1.0.0)
39
+ faraday-rack (1.0.0)
40
+ faraday-retry (1.0.3)
41
+ faraday_middleware (1.2.0)
24
42
  faraday (~> 1.0)
25
43
  hashdiff (1.0.1)
26
44
  hashie (4.1.0)
27
- json (2.5.1)
45
+ json (2.6.1)
28
46
  multipart-post (2.1.1)
29
- parallel (1.20.1)
30
- parser (3.0.0.0)
47
+ parallel (1.21.0)
48
+ parser (3.1.0.0)
31
49
  ast (~> 2.4.1)
32
50
  public_suffix (4.0.6)
33
- rainbow (3.0.0)
34
- rake (13.0.3)
51
+ rainbow (3.1.1)
52
+ rake (13.0.6)
35
53
  rash_alt (0.4.9)
36
54
  hashie (~> 4.1)
37
- regexp_parser (2.0.3)
38
- rexml (3.2.4)
39
- rspec (3.8.0)
40
- rspec-core (~> 3.8.0)
41
- rspec-expectations (~> 3.8.0)
42
- rspec-mocks (~> 3.8.0)
43
- rspec-core (3.8.2)
44
- rspec-support (~> 3.8.0)
45
- rspec-expectations (3.8.6)
55
+ regexp_parser (2.2.1)
56
+ rexml (3.2.5)
57
+ rspec (3.11.0)
58
+ rspec-core (~> 3.11.0)
59
+ rspec-expectations (~> 3.11.0)
60
+ rspec-mocks (~> 3.11.0)
61
+ rspec-core (3.11.0)
62
+ rspec-support (~> 3.11.0)
63
+ rspec-expectations (3.11.0)
46
64
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.8.0)
48
- rspec-mocks (3.8.2)
65
+ rspec-support (~> 3.11.0)
66
+ rspec-mocks (3.11.0)
49
67
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.8.0)
51
- rspec-support (3.8.3)
52
- rubocop (1.8.1)
68
+ rspec-support (~> 3.11.0)
69
+ rspec-support (3.11.0)
70
+ rubocop (1.25.1)
53
71
  parallel (~> 1.10)
54
- parser (>= 3.0.0.0)
72
+ parser (>= 3.1.0.0)
55
73
  rainbow (>= 2.2.2, < 4.0)
56
74
  regexp_parser (>= 1.8, < 3.0)
57
75
  rexml
58
- rubocop-ast (>= 1.2.0, < 2.0)
76
+ rubocop-ast (>= 1.15.1, < 2.0)
59
77
  ruby-progressbar (~> 1.7)
60
78
  unicode-display_width (>= 1.4.0, < 3.0)
61
- rubocop-ast (1.4.1)
62
- parser (>= 2.7.1.5)
63
- rubocop-performance (1.7.1)
64
- rubocop (>= 0.82.0)
79
+ rubocop-ast (1.15.2)
80
+ parser (>= 3.0.1.1)
81
+ rubocop-performance (1.13.2)
82
+ rubocop (>= 1.7.0, < 2.0)
83
+ rubocop-ast (>= 0.4.0)
65
84
  ruby-progressbar (1.11.0)
66
- ruby2_keywords (0.0.4)
85
+ ruby2_keywords (0.0.5)
67
86
  simplecov (0.16.1)
68
87
  docile (~> 1.1)
69
88
  json (>= 1.8, < 3)
70
89
  simplecov-html (~> 0.10.0)
71
90
  simplecov-html (0.10.2)
72
- unicode-display_width (2.0.0)
73
- webmock (3.11.2)
74
- addressable (>= 2.3.6)
91
+ unicode-display_width (2.1.0)
92
+ webmock (3.14.0)
93
+ addressable (>= 2.8.0)
75
94
  crack (>= 0.3.2)
76
95
  hashdiff (>= 0.4.0, < 2.0.0)
77
96
 
78
97
  PLATFORMS
98
+ arm64-darwin-21
79
99
  ruby
80
100
 
81
101
  DEPENDENCIES
82
102
  bundler
83
103
  pactas_itero!
84
104
  rake
85
- rspec (~> 3.8.0)
86
- rubocop (~> 1.8.1)
87
- rubocop-performance (~> 1.7.0)
105
+ rspec (~> 3.11.0)
106
+ rubocop (~> 1.25.1)
107
+ rubocop-performance (~> 1.13.2)
88
108
  simplecov (~> 0.16.1)
89
109
  webmock (~> 3.3)
90
110
 
91
111
  BUNDLED WITH
92
- 2.1.4
112
+ 2.3.7
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- [![Build Status](https://travis-ci.org/shipcloud/pactas_itero.svg)](https://travis-ci.org/shipcloud/pactas_itero)
1
+ [![CircleCI](https://circleci.com/gh/shipcloud/billwerk/tree/master.svg?style=svg)](https://circleci.com/gh/shipcloud/billwerk/tree/master)
2
+ [![Maintainability](https://api.codeclimate.com/v1/badges/cfbdd07da1f178c7fa9a/maintainability)](https://codeclimate.com/github/shipcloud/billwerk/maintainability)
3
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/cfbdd07da1f178c7fa9a/test_coverage)](https://codeclimate.com/github/shipcloud/billwerk/test_coverage)
2
4
 
3
5
  # PactasItero
4
6
 
data/Rakefile CHANGED
@@ -2,13 +2,13 @@ require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec) do |spec|
5
- spec.pattern = FileList['spec/**/*_spec.rb']
5
+ spec.pattern = FileList["spec/**/*_spec.rb"]
6
6
  end
7
7
 
8
8
  task :console do
9
- require 'irb'
10
- require 'irb/completion'
11
- require 'pactas_itero'
9
+ require "irb"
10
+ require "irb/completion"
11
+ require "pactas_itero"
12
12
  ARGV.clear
13
13
  IRB.start
14
14
  end
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ gem install bundler -v "~> 2.0"
7
+ bundle install
@@ -6,6 +6,11 @@ module PactasItero
6
6
  get "api/v1/customers/#{customer_id}/contracts", options
7
7
  end
8
8
 
9
+ def contract_changes(contract_id, options = {})
10
+ options = options.camelize_keys
11
+ get "api/v1/contractChanges", options.merge(contractId: contract_id)
12
+ end
13
+
9
14
  def contracts(options = {})
10
15
  options = options.camelize_keys
11
16
  get "api/v1/contracts", options
@@ -1,13 +1,12 @@
1
1
  module PactasItero
2
2
  module Api
3
3
  module Invoices
4
-
5
4
  def invoices(options = {})
6
5
  options = options.camelize_keys
7
6
  get "api/v1/invoices", options
8
7
  end
9
8
 
10
- def invoices_from(from_id=nil, options = {})
9
+ def invoices_from(from_id = nil, options = {})
11
10
  if from_id
12
11
  options = options.camelize_keys
13
12
  get "api/v1/invoices?from=#{from_id}", options
@@ -1,11 +1,10 @@
1
-
2
1
  module PactasItero
3
2
  module Api
4
3
  module OAuth
5
4
  def token(options = {})
6
5
  options[:bearer_token_request] = true
7
- options[:grant_type] ||= 'client_credentials'
8
- post '/oauth/token', options
6
+ options[:grant_type] ||= "client_credentials"
7
+ post "/oauth/token", options
9
8
  end
10
9
  end
11
10
  end
@@ -6,7 +6,7 @@ module PactasItero
6
6
  quantity: quantity,
7
7
  description: description,
8
8
  price_per_unit: price_per_unit,
9
- tax_policy_id: tax_policy_id
9
+ tax_policy_id: tax_policy_id,
10
10
  )
11
11
  options = options.camelize_keys
12
12
  post "api/v1/contracts/#{contract_id}/ratedItems", options
@@ -1,10 +1,10 @@
1
- require 'pactas_itero/ext/hash/camelize_keys'
2
- require 'pactas_itero/api/oauth'
3
- require 'pactas_itero/api/rated_items'
4
- require 'pactas_itero/api/customers'
5
- require 'pactas_itero/api/contracts'
6
- require 'pactas_itero/api/orders'
7
- require 'pactas_itero/api/invoices'
1
+ require "pactas_itero/ext/hash/camelize_keys"
2
+ require "pactas_itero/api/oauth"
3
+ require "pactas_itero/api/rated_items"
4
+ require "pactas_itero/api/customers"
5
+ require "pactas_itero/api/contracts"
6
+ require "pactas_itero/api/orders"
7
+ require "pactas_itero/api/invoices"
8
8
  require "pactas_itero/api/payment_transactions"
9
9
 
10
10
  module PactasItero
@@ -1,7 +1,7 @@
1
- require 'base64'
2
- require 'rash'
3
- require 'pactas_itero/configurable'
4
- require 'pactas_itero/api'
1
+ require "base64"
2
+ require "rash"
3
+ require "pactas_itero/configurable"
4
+ require "pactas_itero/api"
5
5
 
6
6
  module PactasItero
7
7
  class Client
@@ -12,7 +12,10 @@ module PactasItero
12
12
 
13
13
  def initialize(options = {})
14
14
  PactasItero::Configurable.keys.each do |key|
15
- instance_variable_set(:"@#{key}", options[key] || PactasItero.instance_variable_get(:"@#{key}"))
15
+ instance_variable_set(
16
+ :"@#{key}",
17
+ options[key] || PactasItero.instance_variable_get(:"@#{key}"),
18
+ )
16
19
  end
17
20
  end
18
21
 
@@ -59,29 +62,29 @@ module PactasItero
59
62
  bearer_token_request = params.delete(:bearer_token_request)
60
63
 
61
64
  if bearer_token_request
62
- headers[:accept] = '*/*'
65
+ headers[:accept] = "*/*"
63
66
  headers[:authorization] = bearer_token_credentials_auth_header
64
- headers[:content_type] = 'application/x-www-form-urlencoded; charset=UTF-8'
67
+ headers[:content_type] = "application/x-www-form-urlencoded; charset=UTF-8"
65
68
  else
66
69
  headers[:authorization] = auth_header
67
70
  end
68
71
 
69
- response = connection.send(method.to_sym, path, params) {
70
- |request| request.headers.update(headers)
71
- }.env
72
+ response = connection.send(method.to_sym, path, params) do |request|
73
+ request.headers.update(headers)
74
+ end.env
72
75
  response.body
73
76
  end
74
77
 
75
78
  def connection_options
76
79
  @connection_options ||= {
77
- :builder => middleware,
78
- :headers => {
79
- :accept => default_media_type,
80
- :user_agent => user_agent,
80
+ builder: middleware,
81
+ headers: {
82
+ accept: default_media_type,
83
+ user_agent: user_agent,
81
84
  },
82
- :request => {
83
- :open_timeout => 10,
84
- :timeout => 30,
85
+ request: {
86
+ open_timeout: 10,
87
+ timeout: 30,
85
88
  },
86
89
  }
87
90
  end
@@ -92,11 +95,12 @@ module PactasItero
92
95
  end
93
96
 
94
97
  def bearer_auth_header
95
- token = if bearer_token.respond_to?(:access_token)
96
- bearer_token.access_token
97
- else
98
- bearer_token
99
- end
98
+ token =
99
+ if bearer_token.respond_to?(:access_token)
100
+ bearer_token.access_token
101
+ else
102
+ bearer_token
103
+ end
100
104
  "Bearer #{token}"
101
105
  end
102
106
 
@@ -1,11 +1,10 @@
1
1
  module PactasItero
2
-
3
2
  module Configurable
4
3
  attr_accessor :bearer_token, :client_id, :client_secret, :user_agent,
5
4
  :default_media_type, :middleware, :production
6
5
  attr_writer :api_endpoint
7
- class << self
8
6
 
7
+ class << self
9
8
  # List of configurable keys for PactasItero::Client
10
9
  def keys
11
10
  @keys ||= [
@@ -16,7 +15,7 @@ module PactasItero
16
15
  :user_agent,
17
16
  :default_media_type,
18
17
  :middleware,
19
- :production
18
+ :production,
20
19
  ]
21
20
  end
22
21
  end
@@ -37,8 +36,8 @@ module PactasItero
37
36
 
38
37
  def api_endpoint
39
38
  endpoint = @api_endpoint ||
40
- production && production_api_endpoint ||
41
- sandbox_api_endpoint
39
+ production && production_api_endpoint ||
40
+ sandbox_api_endpoint
42
41
  File.join(endpoint, "")
43
42
  end
44
43
 
@@ -53,7 +52,7 @@ module PactasItero
53
52
  private
54
53
 
55
54
  def options
56
- Hash[PactasItero::Configurable.keys.map{|key| [key, send(:"#{key}")]}]
55
+ Hash[PactasItero::Configurable.keys.map { |key| [key, send(:"#{key}")] }]
57
56
  end
58
57
  end
59
58
  end
@@ -1,12 +1,10 @@
1
- require 'pactas_itero/response/raise_error'
2
- require 'pactas_itero/version'
3
- require 'faraday_middleware'
1
+ require "pactas_itero/response/raise_error"
2
+ require "pactas_itero/version"
3
+ require "faraday_middleware"
4
4
 
5
5
  module PactasItero
6
-
7
6
  # Default configuration options for {Client}
8
7
  module Default
9
-
10
8
  SANDBOX_API_ENDPOINT = "https://sandbox.billwerk.com".freeze
11
9
 
12
10
  PRODUCTION_API_ENDPOINT = "https://app.billwerk.com".freeze
@@ -22,19 +20,18 @@ module PactasItero
22
20
  builder.use PactasItero::Response::RaiseError
23
21
  builder.response :rashify
24
22
  builder.request :url_encoded
25
- builder.response :json, :content_type => /\bjson$/
23
+ builder.response :json, content_type: /\bjson$/
26
24
 
27
25
  builder.adapter Faraday.default_adapter
28
26
  end
29
27
 
30
28
  class << self
31
-
32
29
  def options
33
- Hash[PactasItero::Configurable.keys.map{|key| [key, send(key)]}]
30
+ Hash[PactasItero::Configurable.keys.map { |key| [key, send(key)] }]
34
31
  end
35
32
 
36
33
  def api_endpoint
37
- ENV['PACTAS_ITERO_ENDPOINT']
34
+ ENV["PACTAS_ITERO_ENDPOINT"]
38
35
  end
39
36
 
40
37
  def sandbox_api_endpoint
@@ -50,19 +47,19 @@ module PactasItero
50
47
  end
51
48
 
52
49
  def client_id
53
- ENV['PACTAS_ITERO_CLIENT_ID']
50
+ ENV["PACTAS_ITERO_CLIENT_ID"]
54
51
  end
55
52
 
56
53
  def client_secret
57
- ENV['PACTAS_ITERO_CLIENT_SECRET']
54
+ ENV["PACTAS_ITERO_CLIENT_SECRET"]
58
55
  end
59
56
 
60
57
  def bearer_token
61
- ENV['PACTAS_ITERO_BEARER_TOKEN']
58
+ ENV["PACTAS_ITERO_BEARER_TOKEN"]
62
59
  end
63
60
 
64
61
  def default_media_type
65
- ENV['PACTAS_ITERO_CLIENT_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE
62
+ ENV["PACTAS_ITERO_CLIENT_DEFAULT_MEDIA_TYPE"] || MEDIA_TYPE
66
63
  end
67
64
 
68
65
  def middleware
@@ -70,7 +67,7 @@ module PactasItero
70
67
  end
71
68
 
72
69
  def user_agent
73
- ENV['PACTAS_ITERO_USER_AGENT'] || USER_AGENT
70
+ ENV["PACTAS_ITERO_USER_AGENT"] || USER_AGENT
74
71
  end
75
72
  end
76
73
  end
@@ -1,7 +1,6 @@
1
1
  module PactasItero
2
2
  # Custom error class for rescuing from all Pactas errors
3
3
  class Error < StandardError
4
-
5
4
  # Returns the appropriate PactasItero::Error sublcass based
6
5
  # on status and response message
7
6
  #
@@ -32,7 +31,7 @@ module PactasItero
32
31
  end
33
32
  end
34
33
 
35
- def initialize(response=nil)
34
+ def initialize(response = nil)
36
35
  @response = response
37
36
  super(build_error_message)
38
37
  end
@@ -50,9 +49,9 @@ module PactasItero
50
49
  # Returns most appropriate error for 403 HTTP status code
51
50
  # @private
52
51
  def self.error_for_403(body)
53
- if body =~ /rate limit exceeded/i
52
+ if /rate limit exceeded/i.match?(body)
54
53
  PactasItero::TooManyRequests
55
- elsif body =~ /login attempts exceeded/i
54
+ elsif /login attempts exceeded/i.match?(body)
56
55
  PactasItero::TooManyLoginAttempts
57
56
  else
58
57
  PactasItero::Forbidden
@@ -75,15 +74,13 @@ module PactasItero
75
74
  @data ||=
76
75
  if (body = @response[:body]) && !body.empty?
77
76
  if body.is_a?(String) &&
78
- @response[:response_headers] &&
79
- @response[:response_headers][:content_type] =~ /json/
77
+ @response[:response_headers] &&
78
+ @response[:response_headers][:content_type] =~ /json/
80
79
 
81
80
  Sawyer::Agent.serializer.decode(body)
82
81
  else
83
82
  body
84
83
  end
85
- else
86
- nil
87
84
  end
88
85
  end
89
86
 
@@ -105,7 +102,7 @@ module PactasItero
105
102
 
106
103
  summary = "\nError summary:\n"
107
104
  summary << data[:errors].map do |hash|
108
- hash.map { |k,v| " #{k}: #{v}" }
105
+ hash.map { |k, v| " #{k}: #{v}" }
109
106
  end.join("\n")
110
107
 
111
108
  summary
@@ -117,9 +114,9 @@ module PactasItero
117
114
  message = "#{@response[:method].to_s.upcase} "
118
115
  message << redact_url(@response[:url].to_s) + ": "
119
116
  message << "#{@response[:status]} - "
120
- message << "#{response_message}" unless response_message.nil?
121
- message << "#{response_error}" unless response_error.nil?
122
- message << "#{response_error_summary}" unless response_error_summary.nil?
117
+ message << response_message.to_s unless response_message.nil?
118
+ message << response_error.to_s unless response_error.nil?
119
+ message << response_error_summary.to_s unless response_error_summary.nil?
123
120
  message
124
121
  end
125
122
 
@@ -143,12 +140,12 @@ module PactasItero
143
140
  # Raised when Pactas returns a 401 HTTP status code
144
141
  # and headers include "X-Pactas-OTP"
145
142
  class OneTimePasswordRequired < ClientError
146
- #@private
143
+ # @private
147
144
  OTP_DELIVERY_PATTERN = /required; (\w+)/i
148
145
 
149
- #@private
146
+ # @private
150
147
  def self.required_header(headers)
151
- OTP_DELIVERY_PATTERN.match headers['X-Pactas-OTP'].to_s
148
+ OTP_DELIVERY_PATTERN.match headers["X-Pactas-OTP"].to_s
152
149
  end
153
150
 
154
151
  # Delivery method for the user's OTP
@@ -1,13 +1,12 @@
1
1
  class Hash
2
-
3
2
  def camelize_keys(value = self)
4
3
  case value
5
- when Array
6
- value.map { |v| camelize_keys(v) }
7
- when Hash
8
- Hash[value.map { |k, v| [camelize_key(k), camelize_keys(v)] }]
9
- else
10
- value
4
+ when Array
5
+ value.map { |v| camelize_keys(v) }
6
+ when Hash
7
+ Hash[value.map { |k, v| [camelize_key(k), camelize_keys(v)] }]
8
+ else
9
+ value
11
10
  end
12
11
  end
13
12
 
@@ -27,6 +26,6 @@ class Hash
27
26
  def camelize(term)
28
27
  string = term.to_s
29
28
  string = string.sub(/^[a-z\d]*/) { $&.capitalize }
30
- string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
29
+ string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub("/", "::")
31
30
  end
32
31
  end
@@ -1,14 +1,12 @@
1
- require 'faraday'
2
- require 'pactas_itero/error'
1
+ require "faraday"
2
+ require "pactas_itero/error"
3
3
 
4
4
  module PactasItero
5
5
  # Faraday response middleware
6
6
  module Response
7
-
8
7
  # This class raises an PactasItero-flavored exception based
9
8
  # HTTP status codes returned by the API
10
9
  class RaiseError < Faraday::Middleware
11
-
12
10
  def on_complete(response)
13
11
  if error = PactasItero::Error.from_response(response)
14
12
  raise error
@@ -1,3 +1,3 @@
1
1
  module PactasItero
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.7.0".freeze
3
3
  end
data/lib/pactas_itero.rb CHANGED
@@ -1,5 +1,5 @@
1
- require 'pactas_itero/client'
2
- require 'pactas_itero/default'
1
+ require "pactas_itero/client"
2
+ require "pactas_itero/default"
3
3
 
4
4
  module PactasItero
5
5
  class << self