woocommerce_api 1.3.0 → 1.4.0

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: 90e10672f2246b6da09dcfb1fa118ffb211bba22
4
- data.tar.gz: b46077f27945fcc5477bfb2592feb227454111de
3
+ metadata.gz: 84cc24498cdb97c4d3ccfbac8cf1b667f4a52f18
4
+ data.tar.gz: 6b2340123359a713911ff41cd314636931fa573c
5
5
  SHA512:
6
- metadata.gz: f4b3b16a8f5174d0a01234c939a5e580b1b50e068ee5d4d81905caf65d5c976022a0de21e195d6f4bbf52a053bf87ae64c23950959ed84c427126c25f3bb481c
7
- data.tar.gz: abd9c524c195134f5d70516feda74bffd9d1c0d4dbce49c162654185b6c570753c1fa630c4ea417acef4539931ec9805758854740f690ba5aa001ebc2e02dcd9
6
+ metadata.gz: 58b89491b5c6033f3c0485597efbbf716e03c955d794046bee11bfab0f3bfa93b9a1c3261e5558f88ce9dddcdb03ba48ce1e946ba89c788e7a0af7e202ce84c9
7
+ data.tar.gz: 6ee70bd6f3135854ab94993c37fc583c4e5b7b5071308fd767138e676768772927b4f2a71236b106b1716f7c9a2ee0ad7ada6cd288a6db1d0504788b1535a4ec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015, WooThemes (http://www.woothemes.com/)
3
+ Copyright (c) 2015, WooThemes (https://woocommerce.com/)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Ruby wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this library.
4
4
 
5
- [![build status](https://secure.travis-ci.org/woothemes/wc-api-ruby.svg)](http://travis-ci.org/woothemes/wc-api-ruby)
5
+ [![build status](https://secure.travis-ci.org/woocommerce/wc-api-ruby.svg)](http://travis-ci.org/woocommerce/wc-api-ruby)
6
6
  [![gem version](https://badge.fury.io/rb/woocommerce_api.svg)](https://rubygems.org/gems/woocommerce_api)
7
7
 
8
8
  ## Installation
@@ -13,14 +13,14 @@ gem install woocommerce_api
13
13
 
14
14
  ## Getting started
15
15
 
16
- Generate API credentials (Consumer Key & Consumer Secret) following this instructions <http://docs.woothemes.com/document/woocommerce-rest-api/>
16
+ Generate API credentials (Consumer Key & Consumer Secret) following this instructions <http://docs.woocommerce.com/document/woocommerce-rest-api/>
17
17
  .
18
18
 
19
- Check out the WooCommerce API endpoints and data that can be manipulated in <http://woothemes.github.io/woocommerce-rest-api-docs/>.
19
+ Check out the WooCommerce API endpoints and data that can be manipulated in <https://woocommerce.github.io/woocommerce-rest-api-docs/>.
20
20
 
21
21
  ## Setup
22
22
 
23
- Setup for the old WooCommerce API v3:
23
+ Setup for the new WP REST API integration (WooCommerce 2.6 or later):
24
24
 
25
25
  ```ruby
26
26
  require "woocommerce_api"
@@ -28,11 +28,15 @@ require "woocommerce_api"
28
28
  woocommerce = WooCommerce::API.new(
29
29
  "http://example.com",
30
30
  "ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
31
- "cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
31
+ "cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
32
+ {
33
+ wp_api: true,
34
+ version: "wc/v1"
35
+ }
32
36
  )
33
37
  ```
34
38
 
35
- Setup for the new WP REST API integration (WooCommerce 2.6 or later):
39
+ Setup for the WooCommerce legacy API:
36
40
 
37
41
  ```ruby
38
42
  require "woocommerce_api"
@@ -42,8 +46,7 @@ woocommerce = WooCommerce::API.new(
42
46
  "ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
43
47
  "cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
44
48
  {
45
- wp_api: true,
46
- version: "wc/v1"
49
+ version: "v3"
47
50
  }
48
51
  )
49
52
  ```
@@ -67,6 +70,7 @@ woocommerce = WooCommerce::API.new(
67
70
  | `signature_method` | `String` | no | Signature method used for oAuth requests, works with `HMAC-SHA1` and `HMAC-SHA256`, default is `HMAC-SHA256` |
68
71
  | `query_string_auth` | `Bool` | no | Force Basic Authentication as query string when `true` and using under HTTPS, default is `false` |
69
72
  | `debug_mode` | `Bool` | no | Enables HTTParty debug mode |
73
+ | `httparty_args` | `Hash` | no | Allows extra HTTParty args |
70
74
 
71
75
  ## Methods
72
76
 
@@ -118,6 +122,7 @@ puts response.headers["x-wc-totalpages"] # Total of pages
118
122
 
119
123
  ## Release History
120
124
 
125
+ - 2016-12-14 - 1.4.0 - Introduces `httparty_args` arg and fixed compatibility with WordPress 4.7.
121
126
  - 2016-09-15 - 1.3.0 - Added the `query_string_auth` and `debug_mode` options.
122
127
  - 2016-06-26 - 1.2.1 - Fixed oAuth signature for WP REST API.
123
128
  - 2016-05-09 - 1.2.0 - Added support for WP REST API and added method to do HTTP OPTIONS requests.
@@ -18,7 +18,8 @@ module WooCommerce
18
18
  wp_api: false,
19
19
  version: "v3",
20
20
  verify_ssl: true,
21
- signature_method: "HMAC-SHA256"
21
+ signature_method: "HMAC-SHA256",
22
+ httparty_args: {}
22
23
  }
23
24
  args = defaults.merge(args)
24
25
 
@@ -28,6 +29,7 @@ module WooCommerce
28
29
  @signature_method = args[:signature_method]
29
30
  @debug_mode = args[:debug_mode]
30
31
  @query_string_auth = args[:query_string_auth]
32
+ @httparty_args = args[:httparty_args]
31
33
 
32
34
  # Internal args
33
35
  @is_ssl = @url.start_with? "https"
@@ -123,17 +125,23 @@ module WooCommerce
123
125
  def do_request method, endpoint, data = {}
124
126
  url = get_url(endpoint, method)
125
127
  options = {
126
- format: :json,
127
- verify: @verify_ssl,
128
- headers: {
129
- "User-Agent" => "WooCommerce API Client-Ruby/#{WooCommerce::VERSION}",
130
- "Content-Type" => "application/json;charset=utf-8",
131
- "Accept" => "application/json"
132
- }
128
+ format: :json
133
129
  }
134
130
 
131
+ # Allow custom HTTParty args.
132
+ options = @httparty_args.merge(options)
133
+
134
+ # Set headers.
135
+ options[:headers] = {
136
+ "User-Agent" => "WooCommerce API Client-Ruby/#{WooCommerce::VERSION}",
137
+ "Accept" => "application/json"
138
+ }
139
+ options[:headers]["Content-Type"] = "application/json;charset=utf-8" if !data.empty?
140
+
135
141
  # Set basic authentication.
136
142
  if @is_ssl
143
+ options[:verify] = @verify_ssl
144
+
137
145
  if @query_string_auth
138
146
  options.merge!(query: {
139
147
  consumer_key: @consumer_key,
@@ -1,3 +1,3 @@
1
1
  module WooCommerce
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woocommerce_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Sanches
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -16,22 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.13'
19
+ version: '0.14'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.13.7
22
+ version: 0.14.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.13'
29
+ version: '0.14'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.13.7
32
+ version: 0.14.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.0.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.0.0
33
53
  description: This gem provide a wrapper to deal with the WooCommerce REST API
34
- email: claudio@woothemes.com
54
+ email: claudio@automattic.com
35
55
  executables: []
36
56
  extensions: []
37
57
  extra_rdoc_files:
@@ -43,7 +63,7 @@ files:
43
63
  - lib/woocommerce_api.rb
44
64
  - lib/woocommerce_api/oauth.rb
45
65
  - lib/woocommerce_api/version.rb
46
- homepage: https://github.com/woothemes/wc-api-ruby
66
+ homepage: https://github.com/woocommerce/wc-api-ruby
47
67
  licenses:
48
68
  - MIT
49
69
  metadata: {}