zanoxrb 0.5.9 → 0.5.10

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: e0958f0151872c562edbc296fd04aec030ab3030
4
- data.tar.gz: f2132e1ec3da109e8515db59286263e072e2d447
3
+ metadata.gz: 6cee01d977d3efe66d38c2b5c87f056e9c061b4d
4
+ data.tar.gz: 195be168b80e025a82213abe937a09ac4d4f116c
5
5
  SHA512:
6
- metadata.gz: 34b3b70c86505a820642d446e82a28069e46896e54658b2a003243ae1f0d13a34f494a08d4cde61fd3bbfd1625b506b25bd1f0c5b52297687666b6e1a56af7de
7
- data.tar.gz: b3955a86f293d6b2c839273d542d7208654803a82e14758ac497d873bdb06addd4a2b4037b68cde2a6b1fcf2e4c469b0250bb09386b9cec04476e87fddfb4258
6
+ metadata.gz: 8ce51a6d55ed6463a7aeeaa062a663ef5ff02efda13b2a85728641929d572cfaa0b4eab38327d772133edb70378725274bafb58c1abfbe8b23a9e114832d1170
7
+ data.tar.gz: 06a3e2da259411ebb408bd11249f01af61151bab7d7f9bb1dcea054c31e8be82b73dcfada4068e2ed9389799578e5a779d786f4cf7729335e8d7ff5fc6d5e035
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zanoxrb (0.5.9)
4
+ zanoxrb (0.5.10)
5
5
  httparty (~> 0.13)
6
6
  ruby-try (~> 1.1)
7
7
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ZanoxRB [![Build Status](https://travis-ci.org/mozestudio/zanox-rb.svg)](https://travis-ci.org/mozestudio/zanox-rb)
1
+ ZanoxRB [![Build Status](https://travis-ci.org/mozestudio/zanox-rb.svg)](https://travis-ci.org/mozestudio/zanox-rb) [![Gem Version](https://img.shields.io/gem/v/zanoxrb.svg)](https://rubygems.org/gems/zanoxrb)
2
2
  =======
3
3
  A Ruby wrapper for Zanox's RESTful APIs because all the current alternatives outta here are shit.
4
4
 
@@ -25,7 +25,7 @@
25
25
  module Zanox
26
26
  class Product < Item
27
27
  attr_reader :pid, :name, :program, :description, :excerpt, :manufacturer, :category,
28
- :images, :currency, :price, :shipping_costs, :delivery_time, :tracking_link
28
+ :images, :currency, :price, :price_old, :shipping_costs, :delivery_time, :tracking_link
29
29
  attr_accessor :pagination
30
30
 
31
31
  ###################
@@ -60,6 +60,7 @@ module Zanox
60
60
  }
61
61
  @currency = data['currency']
62
62
  @price = data['price'].to_f
63
+ @price_old = data['priceOld'].to_f
63
64
  @shipping_costs = data['shippingCosts'].try(:to_f)
64
65
  @delivery_time = only_numbers(data['deliveryTime'])
65
66
  @tracking_link = data['trackingLinks'].try { |d| d['trackingLink'] }.try { |d| d[0] }.try { |d| d['ppc'] }
@@ -99,6 +100,7 @@ module Zanox
99
100
  end
100
101
 
101
102
  def only_numbers(s)
103
+ return s if s.is_a?(Numeric)
102
104
  s ? s.scan(/\d+/).last.to_i : s
103
105
  end
104
106
  end
@@ -24,10 +24,11 @@
24
24
 
25
25
  module Zanox
26
26
  class TrackingCategory < Item
27
- attr_reader :pid, :program, :adspace, :transaction_type, :sale_fixed, :sale_percent
27
+ attr_reader :pid, :program, :adspace, :transaction_type, :sale_fixed, :sale_percent, :name
28
28
 
29
29
  ###################
30
30
  # - pid (Integer) AdSpace ID
31
+ # - name (String) The name of the tracking category
31
32
  # - program (Hash) The program in input
32
33
  # - adspace (Hash) The adspace in input
33
34
  # - transaction_type (String) The type of the transaction (leads, sales)
@@ -36,6 +37,7 @@ module Zanox
36
37
  ###################
37
38
  def initialize(data)
38
39
  @pid = data['@id'].to_i
40
+ @name = data['name']
39
41
  @program = {
40
42
  id: data['program']['@id'].to_i,
41
43
  name: data['program']['$']
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright(C) 2015 Giovanni Capuano <webmaster@giovannicapuano.net>
2
+ # Copyright(C) 2016 Giovanni Capuano <webmaster@giovannicapuano.net>
3
3
  #
4
4
  # Redistribution and use in source and binary forms, with or without modification, are
5
5
  # permitted provided that the following conditions are met:
@@ -23,5 +23,5 @@
23
23
  #++
24
24
 
25
25
  module Zanox
26
- VERSION = '0.5.9'
26
+ VERSION = '0.5.10'
27
27
  end
@@ -58,6 +58,7 @@ describe Zanox::Product do
58
58
  "modified" => "2015-04-28T03:06:58+02:00",
59
59
  "program" => {"@id" => "7408", "$" => "Asos.com DE"},
60
60
  "price" => 17.99,
61
+ "priceOld" => 25.99,
61
62
  "currency" => "EUR",
62
63
  "trackingLinks" => { "trackingLink" =>
63
64
  [
@@ -92,6 +93,7 @@ describe Zanox::Product do
92
93
  it 'creates a new instance of Product' do
93
94
  product = Zanox::Product.new(data)
94
95
  expect(product.price).to be_a(Float)
96
+ expect(product.price_old).to be_a(Float)
95
97
  expect(product.shipping_costs).to be_a(Float)
96
98
  expect(product.delivery_time).to eq 4
97
99
  expect(product.description).to eq 'ÜBER MICH Hauptmaterial: 58% Baumwolle, 39% Nylon, 3% Elastan SO PFLEGEN SIE MICH Wie auf dem Pflegeetikett angegeben in der Maschine waschen'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zanoxrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-04 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty