Module: AWeber

Defined in:
lib/aweber.rb,
lib/aweber/base.rb,
lib/aweber/oauth.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/campaign.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/custom_field.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, ForbiddenRequestError, NotFoundError, OAuth, OAuthError, RateLimitError, 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,
  :custom_fields        => :CustomField,
  :campaigns            => :Campaign,
  :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



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

def api_endpoint
  @api_endpoint
end

.auth_endpointObject

Parameters:

  • Base (String)

    URL of the Auth server



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

def auth_endpoint
  @auth_endpoint
end

Class Method Details

.api_urlObject



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

def api_url
  File.join api_endpoint, API_VERSION
end

.auth_urlObject



42
43
44
# File 'lib/aweber.rb', line 42

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



51
52
53
# File 'lib/aweber.rb', line 51

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