skroutz 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/.gitignore +26 -0
  2. data/.hound.yml +2 -0
  3. data/.rubocop.yml +50 -0
  4. data/.travis.yml +14 -0
  5. data/CHANGELOG.md +82 -0
  6. data/CONTRIBUTING.md +42 -0
  7. data/Gemfile +20 -0
  8. data/Guardfile +17 -0
  9. data/LICENSE.txt +22 -0
  10. data/README.md +301 -0
  11. data/Rakefile +7 -0
  12. data/lib/skroutz.rb +31 -0
  13. data/lib/skroutz/address.rb +1 -0
  14. data/lib/skroutz/addresses_collection.rb +1 -0
  15. data/lib/skroutz/associations.rb +30 -0
  16. data/lib/skroutz/autocomplete.rb +4 -0
  17. data/lib/skroutz/autocomplete_collection.rb +1 -0
  18. data/lib/skroutz/categories_collection.rb +1 -0
  19. data/lib/skroutz/category.rb +6 -0
  20. data/lib/skroutz/client.rb +89 -0
  21. data/lib/skroutz/collection_proxy.rb +71 -0
  22. data/lib/skroutz/default.rb +20 -0
  23. data/lib/skroutz/errors.rb +96 -0
  24. data/lib/skroutz/favorite.rb +1 -0
  25. data/lib/skroutz/favorite_list.rb +1 -0
  26. data/lib/skroutz/favorite_lists_collection.rb +1 -0
  27. data/lib/skroutz/favorites_collection.rb +1 -0
  28. data/lib/skroutz/filter_group.rb +1 -0
  29. data/lib/skroutz/filter_groups_collection.rb +1 -0
  30. data/lib/skroutz/inflections.rb +4 -0
  31. data/lib/skroutz/location.rb +1 -0
  32. data/lib/skroutz/locations_collection.rb +1 -0
  33. data/lib/skroutz/manufacturer.rb +4 -0
  34. data/lib/skroutz/manufacturers_collection.rb +1 -0
  35. data/lib/skroutz/notification.rb +1 -0
  36. data/lib/skroutz/notifications_collection.rb +1 -0
  37. data/lib/skroutz/paginated_collection.rb +45 -0
  38. data/lib/skroutz/parsing.rb +58 -0
  39. data/lib/skroutz/product.rb +5 -0
  40. data/lib/skroutz/products_collection.rb +9 -0
  41. data/lib/skroutz/resource.rb +74 -0
  42. data/lib/skroutz/review.rb +1 -0
  43. data/lib/skroutz/reviews_collection.rb +1 -0
  44. data/lib/skroutz/shop.rb +5 -0
  45. data/lib/skroutz/shops_collection.rb +1 -0
  46. data/lib/skroutz/sku.rb +8 -0
  47. data/lib/skroutz/skus_collection.rb +1 -0
  48. data/lib/skroutz/specification.rb +1 -0
  49. data/lib/skroutz/specifications_collection.rb +1 -0
  50. data/lib/skroutz/url_helpers.rb +7 -0
  51. data/lib/skroutz/version.rb +3 -0
  52. data/skroutz.gemspec +29 -0
  53. data/spec/endpoints/autocomplete_spec.rb +40 -0
  54. data/spec/endpoints/categories_spec.rb +11 -0
  55. data/spec/endpoints/favorite_lists_spec.rb +11 -0
  56. data/spec/endpoints/manufacturers_spec.rb +11 -0
  57. data/spec/endpoints/products_spec.rb +11 -0
  58. data/spec/endpoints/search_spec.rb +40 -0
  59. data/spec/endpoints/shops_spec.rb +11 -0
  60. data/spec/endpoints/skus_spec.rb +11 -0
  61. data/spec/fixtures/autocomplete.yml +26 -0
  62. data/spec/fixtures/categories_index.yml +33 -0
  63. data/spec/fixtures/categories_show.yml +29 -0
  64. data/spec/fixtures/favorite_lists_index.yml +37 -0
  65. data/spec/fixtures/manufacturers_index.yml +25 -0
  66. data/spec/fixtures/manufacturers_show.yml +23 -0
  67. data/spec/fixtures/products_show.yml +24 -0
  68. data/spec/fixtures/search.yml +31 -0
  69. data/spec/fixtures/shops_show.yml +25 -0
  70. data/spec/fixtures/skus_show.yml +30 -0
  71. data/spec/skroutz/client_spec.rb +146 -0
  72. data/spec/skroutz/collection_proxy_spec.rb +141 -0
  73. data/spec/skroutz/paginated_collection_spec.rb +293 -0
  74. data/spec/skroutz/resource_spec.rb +102 -0
  75. data/spec/spec_helper.rb +80 -0
  76. data/spec/support/shared_contexts/resource.rb +8 -0
  77. data/spec/support/shared_examples/error_handling.rb +102 -0
  78. data/spec/support/shared_examples/resource.rb +161 -0
  79. metadata +263 -0
@@ -0,0 +1,26 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .rspec
7
+ .ruby-gemset
8
+ .ruby-version
9
+ Gemfile.lock
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ tags
19
+ test/tmp
20
+ test/version_tmp
21
+ tmp
22
+ *.bundle
23
+ *.so
24
+ *.o
25
+ *.a
26
+ mkmf.log
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ config_file: .rubocop.yml
@@ -0,0 +1,50 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'Guardfile'
4
+
5
+ Metrics/LineLength:
6
+ Max: 120
7
+
8
+ Metrics/MethodLength:
9
+ Max: 20
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Style/ClassAndModuleChildren:
15
+ Enabled: false
16
+
17
+ Style/Encoding:
18
+ EnforcedStyle: when_needed
19
+
20
+ Style/SingleLineBlockParams:
21
+ Enabled: false
22
+
23
+ Style/DotPosition:
24
+ EnforcedStyle: trailing
25
+
26
+ Style/PercentLiteralDelimiters:
27
+ PreferredDelimiters:
28
+ "%w": "[]"
29
+
30
+ Style/RaiseArgs:
31
+ EnforcedStyle: compact
32
+
33
+ Style/SpaceInsideBlockBraces:
34
+ EnforcedStyleForEmptyBraces: space
35
+
36
+ Style/Blocks:
37
+ Exclude:
38
+ - spec/**/*.rb
39
+
40
+ Style/EachWithObject:
41
+ Enabled: false
42
+
43
+ Style/SignalException:
44
+ Enabled: false
45
+
46
+ Style/DoubleNegation:
47
+ Enabled: false
48
+
49
+ Style/PerlBackrefs:
50
+ Enabled: false
@@ -0,0 +1,14 @@
1
+ ---
2
+ sudo: false
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.1.0
6
+ - 2.2.0
7
+ - ruby-head
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: ruby-head
11
+ - rvm: jruby-head
12
+ - rvm: rbx-2
13
+ fast_finish: true
14
+ script: bundle exec rake test
@@ -0,0 +1,82 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
4
+
5
+ ## [0.1.0] - 2015-03-29
6
+
7
+ ### Added
8
+
9
+ * Associations. [Read More](https://github.com/skroutz/skroutz.rb#associations)
10
+ * Favorite Lists. User favorite lists can be fetched
11
+ Example:
12
+ ```ruby
13
+ client = Skroutz::Client.new('', '')
14
+ client.user_token = 'a valid user token'
15
+ client.favorite_lists.all
16
+ ```
17
+ * Skroutz::Client#user_token and Skroutz::Client#user_token=
18
+ * Reviews. The reviews of a SKU can be fetched
19
+ Example:
20
+ ```ruby
21
+ client.skus(42).reviews
22
+ ```
23
+ * Specifications. The specifications of a SKU can be fetched
24
+ Example:
25
+ ```ruby
26
+ client.skus(42).specifications
27
+ ```
28
+ * Locations. The locations of a Shop can be fetched
29
+ Example:
30
+ ```ruby
31
+ client.shops(42).locations # GET /shops/42/locations
32
+ ```
33
+ * Rate-limiting error handling, when a request fails due to
34
+ rate-limiting, `Skroutz::RateLimitingError` is raised
35
+ * For all methods which perform a request, the HTTP verb can be
36
+ specified using either the `:verb`, or `:via` options
37
+ Example:
38
+ ```ruby
39
+ client.categories.all(via: :post) # POST /categories
40
+ ```
41
+ * Direct association requests. Intermediate requests for nested
42
+ resources can be avoided
43
+ Example:
44
+ ```ruby
45
+ client.categories(42).skus # Performs 1 request to /categories/42/sks
46
+ ```
47
+ * `Skroutz::Client#autocomplete`
48
+ * AR-like resource inspection using `Skroutz::Resource#inspect`
49
+ * All collections respond to `#meta` with contains response metadata
50
+
51
+ ### Changed
52
+
53
+ * Direct instantiation of abstract class `Skroutz::CollectionProxy` raises `RuntimeError`
54
+ * Responses with status 401 Unauthorized raise `Skroutz::UnauthorizedError`
55
+ * Responses with status 400 Bad Request raise `Skroutz::ClientError`
56
+ * Resource attribute predicate methods always return boolean values
57
+ Example:
58
+ ```ruby
59
+ client.skus.find(42).virtual? # => false
60
+ ```
61
+ * The name of the gem to `skroutz` from `skroutz_api` and the namespace to `Skroutz` from `SkroutzApi` accordingly
62
+ * `Skroutz::PaginatedCollection#is_at_last_page?` is renamed to `#last_page?`
63
+ * `Skroutz::PaginatedCollection#is_at_first_page?` is renamed to `#first_page?`
64
+ * Trying to fetch a non-existant page returns nil instead of empty Array
65
+ * Pagination methods depend only on link headers
66
+ * Resources and collections are automatically inferred at parsing based
67
+ on the root key of the JSON response
68
+
69
+ ### Fixed
70
+ * Properly handle requests and parsing of two_word resources (eg. filter_groups)
71
+ * Make `Skroutz::Client#search` work
72
+
73
+ ## [0.0.4] - 2015-03-22
74
+ ### Changed
75
+
76
+ * Make response timeout configurable (in seconds)
77
+ * Make HTTP adapter configurable
78
+ * Make response logger configurable
79
+
80
+ ### Fixed
81
+
82
+ * Memoization in SkroutzApi::Resource#resource now works as expected
@@ -0,0 +1,42 @@
1
+ # Contributing
2
+
3
+ If you discover issues, have ideas for improvements or new features,
4
+ please report them to the [issue tracker][1] of the repository or
5
+ submit a pull request. Please, try to follow these guidelines when you
6
+ do so.
7
+
8
+ ## Issue reporting
9
+
10
+ * Check that the issue has not already been reported.
11
+ * Check that the issue has not already been fixed in the latest code
12
+ (a.k.a. `master`).
13
+ * Be clear, concise and precise in your description of the problem.
14
+ * Open an issue with a descriptive title and a summary in grammatically correct,
15
+ complete sentences.
16
+ * Mention the version of the gem you are using.
17
+ * Include any relevant code to the issue summary.
18
+
19
+ ## Pull requests
20
+
21
+ * Read [how to properly contribute to open source projects on Github][2].
22
+ * Fork the project.
23
+ * Use a topic/feature branch to easily amend a pull request later, if necessary.
24
+ * Write [good commit messages][3].
25
+ * Use the same coding conventions as the rest of the project.
26
+ * Commit and push until you are happy with your contribution.
27
+ * Make sure to add tests for it. This is important so I don't break it
28
+ in a future version unintentionally.
29
+ * Add an entry to the [Changelog](CHANGELOG.md) accordingly.
30
+ * Make sure the test suite is passing and the code you wrote doesn't produce
31
+ RuboCop offenses.
32
+ * [Squash related commits together][5].
33
+ * Open a [pull request][4] that relates to *only* one subject with a clear title
34
+ and description in grammatically correct, complete sentences.
35
+
36
+ This text is adapted from [rubocop - contributing](https://github.com/bbatsov/rubocop/blob/master/CONTRIBUTING.md)
37
+
38
+ [1]: https://github.com/skroutz/skroutz.rb/issues
39
+ [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
40
+ [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
41
+ [4]: https://help.github.com/articles/using-pull-requests
42
+ [5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify gem dependencies in skroutz.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'awesome_print', require: 'ap'
8
+ gem 'pry-debugger', platforms: :mri_19
9
+ gem 'pry-byebug', platforms: :mri_21
10
+ gem 'pry-doc'
11
+
12
+ gem 'guard-rubocop', require: false
13
+ gem 'rubocop', '~> 0.29.0'
14
+ end
15
+
16
+ group :test do
17
+ gem 'guard-rspec', require: false
18
+ gem 'coveralls', require: false
19
+ gem 'webmock', '>= 1.9'
20
+ end
@@ -0,0 +1,17 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ rspec_options = {
5
+ cmd: 'bundle exec rspec --order rand'
6
+ }
7
+
8
+ guard 'rspec', rspec_options do
9
+ watch(%r{^spec/.+_spec\.rb$})
10
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
11
+ watch('spec/spec_helper.rb') { 'spec' }
12
+ end
13
+
14
+ guard :rubocop, all_on_start: false, cli: '-D' do
15
+ watch(%r{.+\.rb$})
16
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
17
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dimitris Zorbas
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,301 @@
1
+ # skroutz.rb
2
+
3
+ [![Build Status](https://travis-ci.org/skroutz/skroutz.rb.svg?branch=master)](https://travis-ci.org/skroutz/skroutz.rb)
4
+ [![Code Climate](https://codeclimate.com/github/skroutz/skroutz.rb/badges/gpa.svg)](https://codeclimate.com/github/skroutz/skroutz.rb)
5
+ [![Coverage Status](https://coveralls.io/repos/skroutz/skroutz.rb/badge.svg)](https://coveralls.io/r/skroutz/skroutz.rb)
6
+ [![Documentation Status](http://inch-ci.org/github/skroutz/skroutz.rb.svg?branch=master)](http://inch-ci.org/github/skroutz/skroutz.rb)
7
+
8
+ Ruby API client for [Skroutz](https://skroutz.gr) / [Alve](https://alve.com) / [Scrooge](https://scrooge.co.uk)
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ gem install skroutz
14
+ ```
15
+
16
+ Or add it to your Gemfile
17
+
18
+ ```ruby
19
+ gem 'skroutz'
20
+ ```
21
+
22
+ ## Resources
23
+
24
+ - [Category](http://developer.skroutz.gr/api/v3/category/)
25
+ - [Sku](http://developer.skroutz.gr/api/v3/sku/)
26
+ - [Product](http://developer.skroutz.gr/api/v3/product/)
27
+ - [Shop](http://developer.skroutz.gr/api/v3/shop/)
28
+ - [Manufacturer](http://developer.skroutz.gr/api/v3/manufacturer/)
29
+ - [FilterGroup](http://developer.skroutz.gr/api/v3/filter_groups/)
30
+ - [Favorite](http://developer.skroutz.gr/api/v3/favorites/)
31
+ - [Notification](http://developer.skroutz.gr/api/v3/notifications/)
32
+
33
+ ## Creating a client
34
+
35
+ ```ruby
36
+ skroutz = Skroutz::Client.new('client_id', 'client_secret')
37
+ ```
38
+
39
+ ## Search
40
+
41
+ ```ruby
42
+ skroutz.search('iphone')
43
+
44
+ # => [#<Skroutz::Category id: 40, name: "Κινητά Τηλέφωνα", children_count: 0,
45
+ # image_url: "http://a.scdn.gr/images/categories/large/40.jpg", parent_id:
46
+ # 86, fashion: false, path: "76,1269,2,86,40", show_specifications: true,
47
+ # manufacturer_title: "Κατασκευαστές", match_count: 18>,
48
+ # #<Skroutz::Category id: 583, name: "Ανταλλακτικά Κινητών τηλεφώνων",
49
+ # children_count: 0, image_url: "http://a.scdn.gr/images/categories/large/583.jpg", parent_id: 86,
50
+ # fashion: false, path: "76,1269,2,86,583", show_specifications: false,
51
+ # manufacturer_title: "Κατασκευαστές", match_count: 4062>
52
+ # ...
53
+ ```
54
+
55
+
56
+ ## Examples
57
+
58
+ ### Categories
59
+
60
+ ```ruby
61
+ skroutz = Skroutz::Client.new('client_id', 'client_secret')
62
+
63
+ mobile_phones = skroutz.categories.find 40
64
+
65
+ # => #<Skroutz::Category id: 40, name: "Κινητά Τηλέφωνα", children_count: 0,
66
+ # image_url: "http://a.scdn.gr/images/categories/large/40.jpg", parent_id:
67
+ # 86, fashion: false, path: "76,1269,2,86,40", show_specifications: true,
68
+ # manufacturer_title: "Κατασκευαστές">
69
+
70
+ # Get all categories, paginated
71
+ skroutz.categories.all
72
+ # => [#<Skroutz::Category id: 1, name: "Σταθερή Τηλεφωνία", children_count: 5,
73
+ # image_url: "http://a.scdn.gr/images/categories/large/1.jpg", parent_id: 2,
74
+ # fashion: false, path: "76,1269,2,1", show_specifications: false,
75
+ # manufacturer_title: "Κατασκευαστές">,
76
+ # #<Skroutz::Category id: 2, name: "Τηλεφωνία", children_count: 3,
77
+ # image_url: "http://d.scdn.gr/images/categories/large/201501271...",
78
+ # parent_id: 1269, fashion: false, path: "76,1269,2", show_specifications:
79
+ # false, manufacturer_title: "Κατασκευαστές">,
80
+ # #<Skroutz::Category id: 5, name: "Φωτογραφία & Video", children_count:
81
+ # 3, image_url: "http://a.scdn.gr/images/categories/large/5.jpg",
82
+ # parent_id: 1269, fashion: false, path: "76,1269,5", show_specifications:
83
+ # false, manufacturer_title: "Κατασκευαστές">,
84
+ # #<Skroutz::Category id: 6, name: "Διάφορα Εικόνας", children_count: 2,
85
+ # image_url: "http://c.scdn.gr/images/categories/large/201501271...",
86
+ # parent_id: 309, fashion: false, path: "76,1269,309,6",
87
+ # show_specifications: false, manufacturer_title: "Κατασκευαστές">,
88
+ # ...
89
+
90
+ # Get the SKUs of a Category without intermediate requests
91
+ skroutz.categories(40).skus
92
+ # => [#<Skroutz::Sku id: 2119391, ean: "", pn: "GT-E1200", name: "E1200",
93
+ # display_name: "Samsung E1200", category_id: 40, first_product_shop_info:
94
+ # nil, click_url: nil, price_max: 42.0, price_min: 12.61, reviewscore:
95
+ # 4.39286, shop_count: 20, plain_spec_summary: "Feature Phone, Single
96
+ # SIM, Οθόνη: 1.52\" , Μνήμη...", manufacturer_id: 28, future: false,
97
+ # reviews_count: 28, virtual: false, images:
98
+ # {"main"=>"http://d.scdn.gr/images/sku_main_images/002119/2119391/medium_gr_GT-E1200ZWMVGR_301_Front",
99
+ # "alternatives"=>["http://a.scdn.gr/images/sku_images/012918/12918567/gr_GT-E1200ZWMVGR_309_Dynamic",
100
+ # "http://b.scdn.gr/images/sku_images/012918/12918568/gr_GT-E1200ZWMVGR_304_Left",
101
+ # "http://a.scdn.gr/images/sku_images/012918/12918573/gr_GT-E1200ZWMVGR_323_Right",
102
+ # "http://c.scdn.gr/images/sku_images/012918/12918574/gr_GT-E1200ZWMVGR_322_Back"]}>,
103
+ # #<Skroutz::Sku id: 3599366, ean: ...
104
+
105
+
106
+ ```
107
+
108
+ ### SKUs
109
+
110
+ ```ruby
111
+ skroutz = Skroutz::Client.new('client_id', 'client_secret')
112
+
113
+ iphone = skroutz.skus.find 390486
114
+
115
+ # => #<Skroutz::Sku id: 390486, ean: "", pn: "iPhone 4S 16GB", name: "iPhone
116
+ # 4S (16GB)", display_name: "Apple iPhone 4S (16GB)", category_id: 40,
117
+ # first_product_shop_info: "1521|Kaizer Shop|kaizershop", click_url: nil,
118
+ # price_max: 310.0, price_min: 310.0, reviewscore: 4.43284, shop_count: 1,
119
+ # plain_spec_summary: "SmartPhone, Single SIM, Οθόνη: 3.5\" , CPU: 1000
120
+ # M...", manufacturer_id: 356, future: false, reviews_count: 67, virtual:
121
+ # false, images:
122
+ # {"main"=>"http://d.scdn.gr/images/sku_main_images/000390/390486/medium_1234.jpg",
123
+ # "alternatives"=>["http://a.scdn.gr/images/sku_images/012928/12928351/Untitled.jpg",
124
+ # "http://b.scdn.gr/images/sku_images/012928/12928352/12345.jpg",
125
+ # "http://a.scdn.gr/images/sku_images/012928/12928353/smartfon-apple-iphone-4s-16gb-white-md239ru-i-a-30014672b.jpg",
126
+ # "http://a.scdn.gr/images/sku_images/012928/12928354/smartfon-apple-iphone-4s-16gb-white-md239ru-i-a-30014672b2.jpg",
127
+ # "http://b.scdn.gr/images/sku_images/012928/12928355/smartfon-apple-iphone-4s-16gb-white-md239ru-i-a-30014672b1.jpg"]}>
128
+ ```
129
+
130
+ ### Products
131
+
132
+ ```ruby
133
+ skroutz = Skroutz::Client.new('client_id', 'client_secret')
134
+
135
+ iphone_product = skroutz.products.find 12661155
136
+
137
+ # => #<Skroutz::Product id: 12661155, name: "APPLE IPHONE 4S 16GB white EU",
138
+ # sku_id: 390486, shop_id: 2032, category_id: 40, availability: "Σε απόθεμα",
139
+ # click_url: "https://www.skroutz.gr/products/show/12661155?clie...", shop_uid: "312",
140
+ # price: 364.49>
141
+
142
+ ```
143
+
144
+ In this manner you may retrieve most [resources](#resources).
145
+
146
+ ## Pagination
147
+
148
+ For paginated responses, the following methods will be available:
149
+
150
+ * first_page?
151
+ * last_page?
152
+ * first
153
+ * last
154
+ * next
155
+ * previous
156
+
157
+ ## Associations
158
+
159
+ For every `Skroutz::Resource` the available associations can be inspected with:
160
+
161
+ ```ruby
162
+ skroutz = Skroutz::Client.new('client_id', 'client_secret')
163
+
164
+ iphone = skroutz.skus.find 390486
165
+ iphone.class.associations
166
+ # => [:category, :similar, :products, :reviews, :specifications, :manufacturer]
167
+ ```
168
+
169
+ You may call any of the assocations listed you may them as methods like:
170
+
171
+ ```ruby
172
+ iphone = skroutz.skus.find 390486
173
+
174
+ # entity
175
+ iphone.category
176
+ # => #<Skroutz::Category id: 40, name: "Κινητά Τηλέφωνα", children_count: 0, image_url: "http://a.scdn.gr/images/categories/large/40.jpg", parent_id: 86, fashion: false, path: "76,1269,2,86,40", show_specifications: true, manufacturer_title: "Κατασκευαστές">
177
+
178
+ # collection
179
+ iphone.products.all
180
+ # => [#<Skroutz::Product id: 18733068, name: "Nokia 220 Single Sim EU Yellow", sku_id: 5725906, shop_id: 1830, category_id: 40, availability: "Σε απόθεμα", click_url: "https://www.skroutz.gr/products/show/18733068?clie...", shop_uid: "1149024", price: 36.0>,
181
+ #<Skroutz::Product id: 18036272, name: "Nokia 220 Dual Sim Black EU", sku_id: 5725906, shop_id: 941, category_id: 40, availability: "Σε απόθεμα", click_url: "https://www.skroutz.gr/products/show/18036272?clie...", shop_uid: "d30712b4-ed33-475e-9291-f3b3fafc40c9", price: 49.89>]
182
+ ```
183
+
184
+ You may even try more complex things like:
185
+
186
+ ```ruby
187
+ skroutz.search('nexus').first.skus.all.first.products.page(1, per: 2)
188
+ # => [#<Skroutz::Product id: 14343307, name: "TABLET INTENSO TAB 714
189
+ # 5509852", sku_id: 2690329, shop_id: 514, category_id: 1105, availability: "Σε απόθεμα",
190
+ # click_url: "https://www.skroutz.gr/products/show/14343307?clie...", shop_uid: "180979", price: 37.99>,
191
+ # #<Skroutz::Product id: 14385461, name: "Intenso - Tablet 714 7''", sku_id: 2690329,
192
+ # shop_id: 1085, category_id: 1105, availability: "1 έως 3 ημέρες",
193
+ # click_url: "https://www.skroutz.gr/products/show/14385461?clie...", shop_uid: # "3210", price: 66.9>]
194
+
195
+ client.categories(40).skus(q: 'iphone').first.reviews.all
196
+ # => [#<Skroutz::Review id: 49553, user_id: 305635, review: "Αν μπορουσα θα του εβαζα 2.5 αντι για τρια. Αν και...",
197
+ # rating: 3, created_at: "2015-03-16T22:05:56+02:00", demoted: false>,
198
+ # #<Skroutz::Review id: 49477, user_id: 187662, review: "To κινητο δεν βρισκεται παρα πολυ καιρο στην κατοχ...",
199
+ # rating: 5, created_at: "2015-03-15T16:38:38+02:00", demoted: false>,
200
+ # ...]
201
+ ```
202
+
203
+ ## Configuration
204
+
205
+ The following configuration options are available upon client initialization:
206
+
207
+ ### logger
208
+
209
+ Which logger to use.
210
+ **Default**: No logging is performed.
211
+
212
+ Example:
213
+
214
+ ```ruby
215
+ # Log to STDOUT
216
+ client = Skroutz::Client.new('client_id', 'client_secret', logger: Logger.new(STDOUT))
217
+ ```
218
+
219
+ ### timeout
220
+
221
+ How much time (__in seconds__) to wait for a server response.
222
+ **Default**: 5 seconds
223
+
224
+ ### adapter
225
+
226
+ Which HTTP adapter to use to perform the API requests.
227
+ **Default**: `Net::HTTP`
228
+ > Note: You can only pick a [faraday](https://github.com/lostisland/faraday) compatible adapter.
229
+ Make sure you have the gem of the selected adapter installed.
230
+
231
+ ### user_agent
232
+
233
+ The user agent string to use for the API requests.
234
+ **Default**: `skroutz.rb`
235
+
236
+ ### api_endpoint
237
+
238
+ The root URI of the targeted API.
239
+ **Default**: `https://api.skroutz.gr`
240
+
241
+ ### oauth_endpoint
242
+
243
+ The endpoint from which to authorize via OAuth2.0.
244
+ **Default**: `https://skroutz.gr`
245
+
246
+ ### authorization_code_endpoint
247
+
248
+ The endpoint from which to acquire OAuth2.0 [authorization code](https://tools.ietf.org/html/rfc6749#section-4.1).
249
+ **Default**: `/oauth2/authorizations/new`
250
+
251
+ ### token_endpoint
252
+
253
+ The [endpoint](https://tools.ietf.org/html/rfc6749#section-3.2) from which to acquire OAuth2.0 access token.
254
+ **Default**: `/oauth2/token`
255
+
256
+ ### media type
257
+
258
+ The value of the HTTP `Accept` header to specify the desired [media type](http://tools.ietf.org/html/rfc2046).
259
+ **Default**: `application/vnd.skroutz+json; version=3`
260
+
261
+ ### application_permissions
262
+
263
+ The set of [permissions](http://developer.skroutz.gr/authorization/permissions/) to be obtained.
264
+ **Default**: `['public']
265
+
266
+ ## Compatibility
267
+
268
+ The following Ruby implementations are supported:
269
+
270
+ * MRI 1.9.3
271
+ * MRI 2.1.0
272
+ * MRI 2.2.0
273
+
274
+ It may inadvertently work (or seem to work) on other Ruby implementations,
275
+ however support will only be provided for the versions listed above.
276
+
277
+ ## Development
278
+
279
+ Please take some time to read our [contribution guide](CONTRIBUTING.md) first.
280
+
281
+ ### Running the tests
282
+
283
+ Run all the tests:
284
+ ```bash
285
+ bundle exec rake
286
+ ```
287
+
288
+ Run them continuously with guard:
289
+ ```bash
290
+ bundle exec guard
291
+ ```
292
+
293
+ Fix any rubocop offences:
294
+ ```bash
295
+ bundle exec rubocop
296
+ ```
297
+
298
+ # LICENSE
299
+
300
+ Copyright (c) 2015 Skroutz S.A, MIT Licence.
301
+ See [LICENSE.txt](https://github.com/skroutz/skroutz.rb/blob/master/LICENSE.txt) for further details.