hasoffers 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Gemfile.lock +12 -2
- data/Rakefile +1 -1
- data/hasoffers.gemspec +1 -0
- data/lib/has_offers_model.rb +10 -5
- data/lib/hasoffers/version.rb +1 -1
- data/test/has_offers_model_test.rb +34 -0
- data/test/test_helper.rb +3 -1
- metadata +37 -5
- checksums.yaml +0 -15
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== Version 0.1.9
|
2
|
+
* Fix adding errors in has_offers_model that supports Rails 3.2 and above
|
3
|
+
|
4
|
+
== Version 0.1.8
|
5
|
+
* Unescape query string before gsubbing
|
6
|
+
|
1
7
|
== Version 0.1.6
|
2
8
|
* Fix issues with error hash on Response object
|
3
9
|
* Fix issues that occur when sending GET requests over a proxy, switched
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hasoffers (0.1.
|
4
|
+
hasoffers (0.1.9)
|
5
|
+
activemodel (~> 3.2)
|
5
6
|
crack
|
6
7
|
yajl-ruby
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: http://rubygems.org/
|
10
11
|
specs:
|
12
|
+
activemodel (3.2.18)
|
13
|
+
activesupport (= 3.2.18)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
activesupport (3.2.18)
|
16
|
+
i18n (~> 0.6, >= 0.6.4)
|
17
|
+
multi_json (~> 1.0)
|
18
|
+
builder (3.0.4)
|
11
19
|
crack (0.4.2)
|
12
20
|
safe_yaml (~> 1.0.0)
|
21
|
+
i18n (0.6.9)
|
22
|
+
multi_json (1.10.0)
|
13
23
|
rake (0.9.2)
|
14
|
-
safe_yaml (1.0.
|
24
|
+
safe_yaml (1.0.3)
|
15
25
|
yajl-ruby (1.2.0)
|
16
26
|
|
17
27
|
PLATFORMS
|
data/Rakefile
CHANGED
data/hasoffers.gemspec
CHANGED
data/lib/has_offers_model.rb
CHANGED
@@ -40,16 +40,21 @@ module HasOffersModel
|
|
40
40
|
define_method("check_for_errors") do |response|
|
41
41
|
unless response.success?
|
42
42
|
response.error_messages.each do |error_message|
|
43
|
-
|
43
|
+
new_error_message = "HasOffers API Error: #{error_message}"
|
44
|
+
if self.errors.respond_to?(:add_to_base)
|
45
|
+
self.errors.add_to_base new_error_message
|
46
|
+
else
|
47
|
+
self.errors.add :base, new_error_message
|
48
|
+
end
|
44
49
|
end
|
45
50
|
end
|
46
51
|
response.success?
|
47
52
|
end
|
48
53
|
|
49
54
|
end
|
50
|
-
|
55
|
+
|
51
56
|
end
|
52
|
-
|
57
|
+
|
53
58
|
end
|
54
|
-
|
55
|
-
end
|
59
|
+
|
60
|
+
end
|
data/lib/hasoffers/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
2
|
+
require 'has_offers_model'
|
3
|
+
|
4
|
+
class DummyModel
|
5
|
+
include ActiveModel::Validations
|
6
|
+
include HasOffersModel
|
7
|
+
has_offers_model "Affiliate"
|
8
|
+
end
|
9
|
+
|
10
|
+
class HasOffersModelTest < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def create_model
|
13
|
+
DummyModel.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def failed_response
|
17
|
+
OpenStruct.new :success? => false,
|
18
|
+
:error_messages => ["All your fault"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_instantiating_a_new_has_offers_model
|
22
|
+
assert_nothing_raised do
|
23
|
+
create_model
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_adding_errors
|
28
|
+
model = create_model
|
29
|
+
model.check_for_errors failed_response
|
30
|
+
assert model.errors[:base].include?("HasOffers API Error: All your fault"),
|
31
|
+
"HasOffers error was not applied!"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hasoffers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Luke Ludwig
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-05-09 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: crack
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: yajl-ruby
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,13 +38,31 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: activemodel
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.2'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
41
62
|
- !ruby/object:Gem::Dependency
|
42
63
|
name: rake
|
43
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
44
66
|
requirements:
|
45
67
|
- - ! '>='
|
46
68
|
- !ruby/object:Gem::Version
|
@@ -48,6 +70,7 @@ dependencies:
|
|
48
70
|
type: :development
|
49
71
|
prerelease: false
|
50
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
51
74
|
requirements:
|
52
75
|
- - ! '>='
|
53
76
|
- !ruby/object:Gem::Version
|
@@ -87,32 +110,40 @@ files:
|
|
87
110
|
- test/affiliate_test.rb
|
88
111
|
- test/base_test.rb
|
89
112
|
- test/conversion_test.rb
|
113
|
+
- test/has_offers_model_test.rb
|
90
114
|
- test/offer_test.rb
|
91
115
|
- test/report_test.rb
|
92
116
|
- test/test_helper.rb
|
93
117
|
homepage: https://github.com/sportngin/hasoffers
|
94
118
|
licenses:
|
95
119
|
- MIT
|
96
|
-
metadata: {}
|
97
120
|
post_install_message:
|
98
121
|
rdoc_options: []
|
99
122
|
require_paths:
|
100
123
|
- lib
|
101
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
102
126
|
requirements:
|
103
127
|
- - ! '>='
|
104
128
|
- !ruby/object:Gem::Version
|
105
129
|
version: '0'
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
hash: -3236966753044289822
|
106
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
107
135
|
requirements:
|
108
136
|
- - ! '>='
|
109
137
|
- !ruby/object:Gem::Version
|
110
138
|
version: '0'
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
hash: -3236966753044289822
|
111
142
|
requirements: []
|
112
143
|
rubyforge_project: hasoffers
|
113
|
-
rubygems_version:
|
144
|
+
rubygems_version: 1.8.23.2
|
114
145
|
signing_key:
|
115
|
-
specification_version:
|
146
|
+
specification_version: 3
|
116
147
|
summary: Implementation of the HasOffers API for affiliate advertising.
|
117
148
|
test_files:
|
118
149
|
- test/advertiser_test.rb
|
@@ -120,6 +151,7 @@ test_files:
|
|
120
151
|
- test/affiliate_test.rb
|
121
152
|
- test/base_test.rb
|
122
153
|
- test/conversion_test.rb
|
154
|
+
- test/has_offers_model_test.rb
|
123
155
|
- test/offer_test.rb
|
124
156
|
- test/report_test.rb
|
125
157
|
- test/test_helper.rb
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
OGMyYjZmYTRlOTZmZjVlOThmMDc4NWMxODI4ZTdlMDUzZDc5MzljZQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NjYyZTY2N2E1ZmZjOWEwZTQxZTdkZjU0MzExYTViMzZjYzUxZTI4Nw==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
YWViNGIyZGRlM2I4MWFkOWJjZGE4YmQzZGJmNmMxYTVlMTI3ODBiNzViYmU0
|
10
|
-
NmQzN2ExMjgzZGM5ZDA0NTA0YjFlMzAwNzU0Nzk4ZTliNjgwYThjNjlmNTJi
|
11
|
-
NTFmNThlNjBkZmIyN2U4YTlkMWViNjJlMmQ1M2FjOTJhZTJjYWQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MzkwN2Y1MTg1ZGZkYzVkYWZmY2I2YjRkYmQ1OTUzZTA1YjFiMDM2MWM4YTY3
|
14
|
-
MmEyNmM1ZmMxOTU3YzFhMTM1MDg0ZWRhNWQ0MzkyZjc1MTNkNjNhMDNhMTkz
|
15
|
-
ZjQ3MzMwZjc0ZDA5MTUyMGQyZDI5NTFkOWM0OTFhNzgwYzhlZTU=
|