Class: APDM::Channel

Inherits:
Object
  • Object
show all
Defined in:
lib/apdm/channel.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Channel

Returns a new instance of Channel.



35
36
37
38
39
40
41
42
43
44
# File 'lib/apdm/channel.rb', line 35

def initialize(options = {})
  self.label = options[:label]
  self.tld = options[:tld] || 'no'
  self.abbreviation = options[:abbreviation].downcase if options[:abbreviation]
  self.name = options[:name]
  self. = options[:payment_account]
  self.ad_tech_id = options[:ad_tech_id]
  self.locale = options[:locale]
  self.origo_sandbox_id = options[:origo_sandbox_id]
end

Instance Attribute Details

#abbreviationObject

Returns the value of attribute abbreviation.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def abbreviation
  @abbreviation
end

#ad_tech_idObject

Returns the value of attribute ad_tech_id.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def ad_tech_id
  @ad_tech_id
end

#domainObject

Returns the value of attribute domain.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def domain
  @domain
end

#labelObject

Returns the value of attribute label.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def label
  @label
end

#localeObject

Returns the value of attribute locale.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def locale
  @locale
end

#nameObject

Returns the value of attribute name.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def name
  @name
end

#origo_sandbox_idObject

Returns the value of attribute origo_sandbox_id.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def origo_sandbox_id
  @origo_sandbox_id
end

#payment_accountObject

Returns the value of attribute payment_account.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def 
  @payment_account
end

#tldObject

Returns the value of attribute tld.



34
35
36
# File 'lib/apdm/channel.rb', line 34

def tld
  @tld
end

Class Method Details

.allObject



8
9
10
# File 'lib/apdm/channel.rb', line 8

def all
  APDM::CHANNELS
end

.find(identifier) ⇒ Object



12
13
14
# File 'lib/apdm/channel.rb', line 12

def find(identifier)
  find_by_label(identifier) || find_by_url(identifier)
end

.find_by_ad_tech_id(id) ⇒ Object



29
30
31
# File 'lib/apdm/channel.rb', line 29

def find_by_ad_tech_id(id)
  APDM::CHANNELS.find_by_ad_tech_id(id)
end

.find_by_domain(url) ⇒ Object

DEPRECATED



25
26
27
# File 'lib/apdm/channel.rb', line 25

def find_by_domain(url)
  find_by_url(url)
end

.find_by_label(label) ⇒ Object



16
17
18
# File 'lib/apdm/channel.rb', line 16

def find_by_label(label)
  APDM::CHANNELS.find {|channel| channel.label == label}
end

.find_by_url(url) ⇒ Object



20
21
22
# File 'lib/apdm/channel.rb', line 20

def find_by_url(url)
  APDM::CHANNELS.find_by_url(url)
end

Instance Method Details

#==(other) ⇒ Object



83
84
85
# File 'lib/apdm/channel.rb', line 83

def ==(other)
  label == other.label
end

#feed_url(options) ⇒ Object



62
63
64
65
# File 'lib/apdm/channel.rb', line 62

def feed_url(options)
  options = {:extendedFeed => true}.merge(options)
  "#{homepage}/service/rss?#{QueryParams.encode(options)}"
end

#homepageObject



50
51
52
# File 'lib/apdm/channel.rb', line 50

def homepage
  "http://#{hostname}"
end

#hostnameObject



54
55
56
# File 'lib/apdm/channel.rb', line 54

def hostname
  "www.#{domain}"
end

#logo_srcObject



67
68
69
# File 'lib/apdm/channel.rb', line 67

def logo_src
  "#{APDM::DesignElements::HOST}#{hostname}/gfx/normal_logo.gif"
end

#low_res_logo_srcObject



71
72
73
# File 'lib/apdm/channel.rb', line 71

def low_res_logo_src
  "#{APDM::DesignElements::HOST}#{hostname}/gfx/lav_logo.gif"
end

#payment_configObject



79
80
81
# File 'lib/apdm/channel.rb', line 79

def payment_config
  APDM..merge :account => 
end

#saxo_configObject



75
76
77
# File 'lib/apdm/channel.rb', line 75

def saxo_config
  APDM.saxo_server.merge :remote_dir => saxo_dir
end

#saxo_dirObject



46
47
48
# File 'lib/apdm/channel.rb', line 46

def saxo_dir
  abbreviation.upcase
end