Module: AWeber

Defined in:
lib/aweber.rb,
lib/aweber/base.rb,
lib/aweber/oauth.rb,
lib/chubasaweber.rb,
lib/aweber/resource.rb,
lib/aweber/collection.rb,
lib/aweber/resources/link.rb,
lib/aweber/resources/list.rb,
lib/aweber/resources/open.rb,
lib/aweber/resources/click.rb,
lib/aweber/resources/account.rb,
lib/aweber/resources/message.rb,
lib/aweber/resources/followup.rb,
lib/aweber/resources/web_form.rb,
lib/aweber/resources/broadcast.rb,
lib/aweber/resources/subscriber.rb,
lib/aweber/resources/integration.rb,
lib/aweber/resources/tracked_event.rb,
lib/aweber/resources/web_form_split_test.rb,
lib/aweber/resources/web_form_split_test_component.rb

Defined Under Namespace

Modules: Resources Classes: Base, Collection, NotFoundError, OAuth, OAuthError, Resource, UnknownRequestError

Constant Summary collapse

API_VERSION =
"1.0".freeze
AUTH_VERSION =
"1.0".freeze
INFLECTIONS =

Used for has_many and has_one relationships.

{
  :accounts             => :Account,
  :clicks               => :Click,
  :links                => :Link,
  :lists                => :List,
  :messages             => :Message,
  :opens                => :Open,
  :subscribers          => :Subscriber,
  :tracked_events       => :TrackedEvent,
  :integrations         => :Integration,
  :web_forms            => :WebForm,
  :components           => :WebFormSplitTestComponent,
  :web_form_split_tests => :WebFormSplitTest,
  :last_followup_sents  => :Followup
}

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_endpointObject

Parameters:

  • Base (String)

    URL of the API server



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

def api_endpoint
  @api_endpoint
end

.auth_endpointObject

Parameters:

  • Base (String)

    URL of the Auth server



33
34
35
# File 'lib/aweber.rb', line 33

def auth_endpoint
  @auth_endpoint
end

Class Method Details

.api_urlObject



35
36
37
# File 'lib/aweber.rb', line 35

def api_url
  File.join api_endpoint, API_VERSION
end

.auth_urlObject



39
40
41
# File 'lib/aweber.rb', line 39

def auth_url
  File.join auth_endpoint, AUTH_VERSION
end

.get_class(name) ⇒ Object

Retrieves the Resource class based on the INFLECTIONS map and name.

Parameters:

  • name (Symbol)

    Collection name



48
49
50
# File 'lib/aweber.rb', line 48

def get_class(name)
  Resources.const_get(INFLECTIONS[name])
end