semantics3 0.14 → 0.15

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
- ---
2
- SHA512:
3
- data.tar.gz: 22de4265f9f747157538aaaea841d973cff01717a5819e3dd1dd7bb6a9c125bec9e13b971def76687173bc0d1f4a59b1902e1aeeab46dad95c6db06387b43c11
4
- metadata.gz: 6c965a35c1be53ec53a2ad4e027f4a4f5a09e6e4e51700deb358fc4e2bda2adab23f0079fab104c1459e0c699a6f8660b830140d3a9f5373c197ecb1634192a5
5
- SHA1:
6
- data.tar.gz: 87eb62a3971fe270b3bb9ff10199184ca32474ca
7
- metadata.gz: 89880d6fca2a15b13822ac2d251c61fbef9e9bcd
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f5083525a159afac7cfc0ef0d4786e5f41949030
4
+ data.tar.gz: 8656fbaabf23e6768cc1db224019f1870428ef64
5
+ SHA512:
6
+ metadata.gz: f085e83129397638861c1d547d108aead01c1c603a66b7d3776148e9d12463f6a19f3a681184b695dcbd025ff8c531239de36576d818115d4b581ada44eb5246
7
+ data.tar.gz: ad73f649a3838aecb4b806ae53ef8ba4170998a8f2d9429f18d72b4277fb27bb18666663339e6acfc6a16fe9254b70726be7ab10ff71fa8d6842a6cf2b9f1d35
data/.gitignore CHANGED
@@ -1,2 +1,50 @@
1
- test/
2
1
  *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/README.md CHANGED
@@ -1,9 +1,25 @@
1
1
  # semantics3-ruby
2
2
 
3
3
  semantics3-ruby is a Ruby client for accessing the Semantics3 Products API, which provides structured information, including pricing histories, for a large number of products.
4
- See https://www.semantics3.com for more information.
5
4
 
6
- API documentation can be found at https://www.semantics3.com/docs/
5
+ API documentation can be found at https://docs.semantics3.com/reference.
6
+
7
+ Visit https://www.semantics3.com for more information.
8
+
9
+ - [Installation](#installation)
10
+ - [Requirements](#requirements)
11
+ - [Getting Started](#getting-started)
12
+ - [Setup Work](#setup-work)
13
+ - [First Request](#first-request-aka-hello-world)
14
+ - [Sample Requests](#sample-requests)
15
+ - [Pagination](#pagination)
16
+ - [UPC Query](#upc-query)
17
+ - [Price Filter](#price-filter)
18
+ - [Category ID Query](#category-id-query)
19
+ - [Webhooks](#webhooks)
20
+ - [Creating a webhook](#creating-a-webhook)
21
+ - [Registering events](#registering-events)
22
+ - [Webhook notifications](#webhook-notifications)
7
23
 
8
24
  ## Installation
9
25
 
@@ -21,14 +37,11 @@ To build and install from the latest source:
21
37
 
22
38
  ## Requirements
23
39
 
24
- * json
25
- * oauth
40
+ See [`semantics3.gemspec`](semantics3.gemspec)
26
41
 
27
42
  ## Getting Started
28
43
 
29
- In order to use the client, you must have both an API key and an API secret. To obtain your key and secret, you need to first create an account at
30
- https://www.semantics3.com/
31
- You can access your API access credentials from the user dashboard at https://www.semantics3.com/dashboard/applications
44
+ In order to use the client, you must have both an API key and an API secret. To obtain your key and secret, you need to first create a [Semantics3](https://www.semantics3.com) account. You can access your API access credentials from the user dashboard at https://dashboard.semantics3.com.
32
45
 
33
46
  ### Setup Work
34
47
 
@@ -47,7 +60,7 @@ sem3 = Semantics3::Products.new(API_KEY,API_SECRET)
47
60
 
48
61
  ### First Request aka 'Hello World':
49
62
 
50
- Let's run our first request! We are going to run a simple search fo the word "iPhone" as follows:
63
+ Let's run our first request! We are going to run a simple search for the word "iphone" as follows:
51
64
 
52
65
  ```ruby
53
66
  # Build the request
@@ -95,7 +108,7 @@ Running a UPC/EAN/GTIN query is as simple as running a search query:
95
108
  ```ruby
96
109
  # Build the request
97
110
  sem3.products_field( "upc", "883974958450" )
98
- sem3.products_field( "field", ["name","gtins"] )
111
+ sem3.products_field( "fields", ["name","gtins"] )
99
112
 
100
113
  # Run the request
101
114
  productsHash = sem3.get_products()
@@ -127,7 +140,9 @@ puts productsHash.to_json
127
140
 
128
141
  ### Category ID Query
129
142
 
130
- To lookup details about a cat_id, run your request against the categories resource:
143
+ To lookup details about a cat_id, run your request against the categories resource.
144
+
145
+ Acceptable values for cat_id can be found on the category tree described [here](https://docs.semantics3.com/reference#about-categories).
131
146
 
132
147
  ```ruby
133
148
  # Build the request
@@ -141,12 +156,13 @@ puts productsHash.to_json
141
156
  ```
142
157
 
143
158
  ## Webhooks
144
- You can use webhooks to get near-real-time price updates from Semantics3.
159
+
160
+ You can use webhooks to get near-real-time price updates from Semantics3.
145
161
 
146
162
  ### Creating a webhook
147
163
 
148
164
  You can register a webhook with Semantics3 by sending a POST request to `"webhooks"` endpoint.
149
- To verify that your URL is active, a GET request will be sent to your server with a `verification_code` parameter. Your server should respond with `verification_code` in the response body to complete the verification process.
165
+ To verify that your URL is active, a GET request will be sent to the registered address with a `verification_code` parameter. Your application must read the `verification_code` query parameter and respond to this request with its value in the response body to complete the verification process.
150
166
 
151
167
  ```ruby
152
168
  params = {
@@ -156,6 +172,7 @@ params = {
156
172
  res = sem3.run_query("webhooks","POST",params)
157
173
  puts res
158
174
  ```
175
+
159
176
  To fetch existing webhooks
160
177
  ```ruby
161
178
  res = sem3.run_query("webhooks","GET")
@@ -172,7 +189,8 @@ puts res
172
189
  ```
173
190
 
174
191
  ### Registering events
175
- Once you register a webhook, you can start adding events to it. Semantics3 server will send you notifications when these events occur.
192
+
193
+ Once you create a webhook, you can start adding events to it. Semantics3 will send you notifications when these events occur.
176
194
  To register events for a specific webhook send a POST request to the `"webhooks/{webhook_id}/events"` endpoint
177
195
 
178
196
  ```ruby
@@ -206,6 +224,7 @@ puts res
206
224
  ```
207
225
 
208
226
  ### Webhook Notifications
227
+
209
228
  Once you have created a webhook and registered events on it, notifications will be sent to your registered webhook URI via a POST request when the corresponding events occur. Make sure that your server can accept POST requests. Here is how a sample notification object looks like
210
229
  ```javascript
211
230
  {
@@ -228,7 +247,9 @@ Once you have created a webhook and registered events on it, notifications will
228
247
 
229
248
  ## Contributing
230
249
 
231
- Use GitHub's standard fork/commit/pull-request cycle. If you have any questions, email <support@semantics3.com>.
250
+ Use GitHub's standard fork/commit/pull-request cycle.
251
+
252
+ If you have any questions, email <support@semantics3.com>.
232
253
 
233
254
  ## Authors
234
255
 
@@ -237,7 +258,7 @@ Use GitHub's standard fork/commit/pull-request cycle. If you have any questions
237
258
 
238
259
  ## Copyright
239
260
 
240
- Copyright (c) 2015 Semantics3 Inc.
261
+ Copyright (c) 2017 Semantics3 Inc.
241
262
 
242
263
  ## License
243
264
 
@@ -259,4 +280,4 @@ Copyright (c) 2015 Semantics3 Inc.
259
280
  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
260
281
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
261
282
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
262
- DEALINGS IN THE SOFTWARE.
283
+ DEALINGS IN THE SOFTWARE.
@@ -16,15 +16,16 @@ module Semantics3
16
16
  @auth={}
17
17
 
18
18
  class Base
19
- def initialize(api_key,api_secret,auth = "oauth")
19
+ def initialize(api_key,api_secret,auth = "oauth",timeout = 60)
20
20
  @api_key = api_key
21
21
  @api_secret = api_secret
22
22
  @auth_method = auth
23
+ @timeout = timeout
23
24
 
24
25
  raise Error.new('API Credentials Missing','You did not supply an api_key. Please sign up at https://semantics3.com/ to obtain your api_key.','api_key') if api_key == ''
25
26
  raise Error.new('API Credentials Missing','You did not supply an api_secret. Please sign up at https://semantics3.com/ to obtain your api_secret.','api_secret') if api_secret == ''
26
27
 
27
- @consumer = OAuth::Consumer.new(@api_key, @api_secret)
28
+ @consumer = OAuth::Consumer.new(@api_key, @api_secret, :timeout => @timeout)
28
29
  @auth = OAuth::AccessToken.new(@consumer)
29
30
  end
30
31
 
@@ -80,7 +81,7 @@ module Semantics3
80
81
 
81
82
  class Products < Base
82
83
 
83
- def initialize api_key, api_secret, auth = 'oauth'
84
+ def initialize api_key, api_secret, auth = 'oauth', timeout = 60
84
85
  super
85
86
  clear()
86
87
  end
@@ -2,12 +2,12 @@ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = 'semantics3'
5
- s.version = '0.14'
5
+ s.version = '0.15'
6
6
  s.summary = 'Ruby bindings for the Semantics3 API'
7
7
  s.description = 'Get access to a constantly updated database of product and price data. See https://semantics3.com/ for more information.'
8
8
  s.authors = ['Sivamani Varun', 'Mounarajan P A', 'Vinoth Gopinathan']
9
9
  s.email = ['varun@semantics3.com']
10
- s.homepage = 'https://semantics3.com'
10
+ s.homepage = 'https://www.semantics3.com'
11
11
  s.require_paths = %w{lib}
12
12
 
13
13
  s.add_dependency('json', '~> 1.8', '>= 1.8.1')
metadata CHANGED
@@ -1,68 +1,86 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: semantics3
3
- version: !ruby/object:Gem::Version
4
- version: "0.14"
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.15'
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Sivamani Varun
8
8
  - Mounarajan P A
9
9
  - Vinoth Gopinathan
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2016-07-14 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+ date: 2018-06-07 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: json
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ~>
22
- - !ruby/object:Gem::Version
23
- version: "1.8"
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.8'
24
22
  - - ">="
25
- - !ruby/object:Gem::Version
23
+ - !ruby/object:Gem::Version
26
24
  version: 1.8.1
27
25
  type: :runtime
28
- version_requirements: *id001
29
- - !ruby/object:Gem::Dependency
30
- name: oauth
31
26
  prerelease: false
32
- requirement: &id002 !ruby/object:Gem::Requirement
33
- requirements:
34
- - - ~>
35
- - !ruby/object:Gem::Version
36
- version: "0.4"
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - "~>"
30
+ - !ruby/object:Gem::Version
31
+ version: '1.8'
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.8.1
35
+ - !ruby/object:Gem::Dependency
36
+ name: oauth
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.4'
37
42
  - - ">="
38
- - !ruby/object:Gem::Version
43
+ - !ruby/object:Gem::Version
39
44
  version: 0.4.6
40
45
  type: :runtime
41
- version_requirements: *id002
42
- - !ruby/object:Gem::Dependency
43
- name: curb
44
46
  prerelease: false
45
- requirement: &id003 !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ~>
48
- - !ruby/object:Gem::Version
49
- version: "0.9"
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - "~>"
50
+ - !ruby/object:Gem::Version
51
+ version: '0.4'
50
52
  - - ">="
51
- - !ruby/object:Gem::Version
53
+ - !ruby/object:Gem::Version
54
+ version: 0.4.6
55
+ - !ruby/object:Gem::Dependency
56
+ name: curb
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
52
64
  version: 0.9.3
53
65
  type: :runtime
54
- version_requirements: *id003
55
- description: Get access to a constantly updated database of product and price data. See https://semantics3.com/ for more information.
56
- email:
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '0.9'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.9.3
75
+ description: Get access to a constantly updated database of product and price data.
76
+ See https://semantics3.com/ for more information.
77
+ email:
57
78
  - varun@semantics3.com
58
79
  executables: []
59
-
60
80
  extensions: []
61
-
62
81
  extra_rdoc_files: []
63
-
64
- files:
65
- - .gitignore
82
+ files:
83
+ - ".gitignore"
66
84
  - Changes
67
85
  - Gemfile
68
86
  - LICENSE
@@ -70,31 +88,27 @@ files:
70
88
  - examples/example.rb
71
89
  - lib/semantics3.rb
72
90
  - semantics3.gemspec
73
- homepage: https://semantics3.com
91
+ homepage: https://www.semantics3.com
74
92
  licenses: []
75
-
76
93
  metadata: {}
77
-
78
94
  post_install_message:
79
95
  rdoc_options: []
80
-
81
- require_paths:
96
+ require_paths:
82
97
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
84
- requirements:
85
- - &id004
86
- - ">="
87
- - !ruby/object:Gem::Version
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
90
- requirements:
91
- - *id004
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
92
108
  requirements: []
93
-
94
109
  rubyforge_project:
95
- rubygems_version: 2.2.2
110
+ rubygems_version: 2.4.6
96
111
  signing_key:
97
112
  specification_version: 4
98
113
  summary: Ruby bindings for the Semantics3 API
99
114
  test_files: []
100
-