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/stat.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, CreationError, 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,
  :stats                => :Stat,
  :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



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

def api_endpoint
  @api_endpoint
end

.auth_endpointObject

Parameters:

  • Base (String)

    URL of the Auth server



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

def auth_endpoint
  @auth_endpoint
end

Class Method Details

.api_urlObject



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

def api_url
  File.join api_endpoint, API_VERSION
end

.auth_urlObject



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

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



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

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