epages-rest 1.0.2 → 1.0.3

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: 6676eb9661237a4c3595dbd3a4bfc5a6829be2df
4
- data.tar.gz: daa58bb9a83513b666ca159396241621326fe257
3
+ metadata.gz: abbbdaf768efb6c4a943963ef45e768d5adc434b
4
+ data.tar.gz: ee5a7d1afbd68df9f2e188ced17aad97f3658aab
5
5
  SHA512:
6
- metadata.gz: 6f36af9de4320fa9d55a5f8f5989de42ae7c94bf36b16ab16e66115883a3ada633eac7d60da6f8ab2e864c1198c4ceed035c23c3ba9ba74459ef174fc0facecc
7
- data.tar.gz: 2679ccd11eea7de87ed145f9e0b92749b02aed185c1ce752846ec906ccb995ad1a6914f241d6013a0488ce3e6f1f8e31a1dcfbae7c8ac13fb99065f2dd0c1934
6
+ metadata.gz: c8490ff0dc25cc868dbfc794908a9bc422898150d24b0202b300251eb26ecd9b6bb396992708c71648eb69b2480bcd1a983c4c99b33dbc171593d96294df91ea
7
+ data.tar.gz: af53cbc4a04ef403810b94b28b4c404eb1fb11eb3bbce92a231f0b5cee2f824b5bd250d7506173ce1fab134dc5bd0287680cb6b547b1d1fcc0c14dce46521b2f
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ [![Build Status](https://travis-ci.org/ePages-de/epages-rest-ruby.svg)](https://travis-ci.org/ePages-de/epages-rest-ruby)
2
+ [![Code Climate](https://codeclimate.com/github/ePages-de/epages-rest-ruby/badges/gpa.svg)](https://codeclimate.com/github/ePages-de/epages-rest-ruby)
3
+ [![Test Coverage](https://codeclimate.com/github/ePages-de/epages-rest-ruby/badges/coverage.svg)](https://codeclimate.com/github/ePages-de/epages-rest-ruby/coverage)
4
+
1
5
  # The Epages REST Ruby Gem
2
6
 
3
7
  A Ruby interface to the Epages REST API
@@ -22,7 +26,7 @@ You can get any public information of any shop indicating only the name of the s
22
26
  # Usage examples
23
27
 
24
28
  The first thing is create your REST shop.
25
- `shop = Epages::REST::Shop.new('shop_name')` or `shop = Epages::REST::Shop.new('shop_name', 'token')`
29
+ `shop = Epages::REST::Shop.new(shop_host, shop_name)` or `shop = Epages::REST::Shop.new(shop_host, shop_name, token)`
26
30
 
27
31
  Once this is done, you can use the API calls.
28
32
 
@@ -31,6 +31,11 @@ module Epages
31
31
  sf_url[%r{epages\/(\w+)}, 1]
32
32
  end
33
33
 
34
+ # returns the host of the shop that belongs to the product
35
+ def host
36
+ URI.parse(sf_url).host
37
+ end
38
+
34
39
  # returns the list of links
35
40
  def links_title
36
41
  links.collect(&:rel)
@@ -6,12 +6,11 @@ module Epages
6
6
  class Request
7
7
  include Epages::Utils
8
8
 
9
- BASE_URL = 'https://pm.epages.com/rs/shops/'
10
9
  attr_accessor :shop, :uri, :path, :request_method, :options, :headers
11
10
 
12
11
  def initialize(object, request_method, path, options = {})
13
12
  @shop = build_shop_from(object)
14
- @uri = URI.parse(BASE_URL + @shop.name.to_s + path)
13
+ @uri = URI.parse("https://#{@shop.host}/rs/shops/#{@shop.name.to_s + path}")
15
14
  @path = uri.path
16
15
  set_options(request_method, options)
17
16
  end
data/lib/epages/shop.rb CHANGED
@@ -2,9 +2,10 @@ require 'epages/error'
2
2
 
3
3
  module Epages
4
4
  class Shop
5
- attr_accessor :name, :token
5
+ attr_accessor :host, :name, :token
6
6
 
7
- def initialize(name, token = nil)
7
+ def initialize(host, name, token = nil)
8
+ @host = host
8
9
  @name = name
9
10
  @token = token
10
11
  end
data/lib/epages/utils.rb CHANGED
@@ -69,7 +69,7 @@ module Epages
69
69
  # returns a shop. If [shop] is not a Epages::REST::Shop create one calling the [shop] method shop_mame
70
70
  def build_shop_from(shop)
71
71
  return shop if shop.is_a? Epages::REST::Shop
72
- Epages::REST::Shop.new(shop.shop_name)
72
+ Epages::REST::Shop.new(shop.host, shop.shop_name)
73
73
  end
74
74
 
75
75
  # returns the object replacing all the keys as symbols
@@ -1,3 +1,3 @@
1
1
  module Epages
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epages-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domingo Cividanes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.5.0
121
+ rubygems_version: 2.5.1
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: A Ruby interface to the Epages Rest API.