Class: Adknowledge::Integrated
- Inherits:
-
Object
- Object
- Adknowledge::Integrated
- Includes:
- Enumerable
- Defined in:
- lib/adknowledge/integrated.rb
Constant Summary collapse
- URL =
'http://integrated.adstation.com'
- API_VER =
'1.3'
- VALID_FIELDS =
[ :recipient, :list, :domain, :subid, :sendingdomain, :sendingip, :numberofrecipients, :redirect, :countrycode, :metrocode, :state, :postalcode, :gender, :dayofbirth, :monthofbirth, :yearofbirth ]
- MANDATORY_FIELDS =
[ :recipient, :list, :domain ]
Instance Attribute Summary collapse
-
#cdomain ⇒ Object
Returns the value of attribute cdomain.
-
#idomain ⇒ Object
Returns the value of attribute idomain.
-
#recipients ⇒ Object
Returns the value of attribute recipients.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#subid ⇒ Object
Returns the value of attribute subid.
-
#test ⇒ Object
Returns the value of attribute test.
Instance Method Summary collapse
-
#domain=(dom) ⇒ Symbol
Set both click-domain and image-domain.
-
#errored_recipients ⇒ Array
Return all errored recipients.
-
#initialize(params = {}) ⇒ Integrated
constructor
Create integrated query object.
-
#map! ⇒ Boolean
Map content for specified recipients.
-
#mapped? ⇒ Boolean
Return confirmation if the mapping query has been run yet.
-
#mapped_recipients ⇒ Array
Return all successfully mapped recipients.
-
#query_params ⇒ Hash
Return the query params that will be sent to Adknowledge integrated API.
Constructor Details
#initialize(params = {}) ⇒ Integrated
Create integrated query object
same domain name for the request
36 37 38 39 40 41 42 |
# File 'lib/adknowledge/integrated.rb', line 36 def initialize params={} @records = [] @mapped = false params.each do |k,v| send("#{k}=", v) end end |
Instance Attribute Details
#cdomain ⇒ Object
Returns the value of attribute cdomain.
12 13 14 |
# File 'lib/adknowledge/integrated.rb', line 12 def cdomain @cdomain end |
#idomain ⇒ Object
Returns the value of attribute idomain.
12 13 14 |
# File 'lib/adknowledge/integrated.rb', line 12 def idomain @idomain end |
#recipients ⇒ Object
Returns the value of attribute recipients.
11 12 13 |
# File 'lib/adknowledge/integrated.rb', line 11 def recipients @recipients end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
11 12 13 |
# File 'lib/adknowledge/integrated.rb', line 11 def request @request end |
#subid ⇒ Object
Returns the value of attribute subid.
12 13 14 |
# File 'lib/adknowledge/integrated.rb', line 12 def subid @subid end |
#test ⇒ Object
Returns the value of attribute test.
12 13 14 |
# File 'lib/adknowledge/integrated.rb', line 12 def test @test end |
Instance Method Details
#domain=(dom) ⇒ Symbol
Set both click-domain and image-domain
94 95 96 |
# File 'lib/adknowledge/integrated.rb', line 94 def domain= dom self.cdomain = self.idomain = dom end |
#errored_recipients ⇒ Array
Return all errored recipients
85 86 87 88 |
# File 'lib/adknowledge/integrated.rb', line 85 def errored_recipients return [] unless mapped? recipients.select{ |r| r['success'] == false } end |
#map! ⇒ Boolean
Map content for specified recipients
65 66 67 68 69 70 71 72 |
# File 'lib/adknowledge/integrated.rb', line 65 def map! unless Adknowledge.token raise ArgumentError, 'Adknowledge token required to perform queries' end merge_recipients! query_result @mapped = true end |
#mapped? ⇒ Boolean
Return confirmation if the mapping query has been run yet
114 115 116 |
# File 'lib/adknowledge/integrated.rb', line 114 def mapped? @mapped end |
#mapped_recipients ⇒ Array
Return all successfully mapped recipients
77 78 79 80 |
# File 'lib/adknowledge/integrated.rb', line 77 def mapped_recipients return [] unless mapped? recipients.select{ |r| r['success'] == true } end |
#query_params ⇒ Hash
Return the query params that will be sent to Adknowledge integrated API
101 102 103 104 105 106 107 108 109 |
# File 'lib/adknowledge/integrated.rb', line 101 def query_params { token: Adknowledge.token, idomain: idomain, cdomain: cdomain, request: request, subid: subid, test: test ? 1 : 0 } end |