getresponse 0.5.1 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3309e86caff2f7bca56e22496abc0c7148354a82
4
+ data.tar.gz: 04288f448042fbee0e3d6445ef5e0a710096b83e
5
+ SHA512:
6
+ metadata.gz: 180a21cb1e8df1cd3ac10649c969ce0d0b9cb5c556ff8979c8350f51d5c304966432d797493f3765bb4e08c41c80ac53d3206045bd3cb215cfef0b9a876f9017
7
+ data.tar.gz: 8e46c79c8fb8a641cffb498b59a112aeb45356511214ee0a7bd96020e798e5b4706491a7f53b4df20d34c8b8de2ce4a0367f7835a7ece008b0455d879f31f572
@@ -4,12 +4,21 @@ Wrapper for GetResponse API.
4
4
  Class interfaces from version 0.2 has changed breaking backward compatibility.
5
5
  Be sure to check changes before update.
6
6
 
7
+ == Compatibility issue
8
+
9
+ Next release (0.6) of getresponse gem will not be compatible with Ruby 1.8.
10
+
7
11
  == Usage
8
12
 
9
13
  Just add to you Gemfile
10
14
 
11
15
  gem "getresponse", :require => "get_response"
12
16
 
17
+ GetResponse offers three API end point according which type of client you are. Standard retail
18
+ clients (getresponse.com etc.) should use GetResponse::Connection class to communicate with API. If
19
+ you are client of getresponse360.com class GetResponse::DedicatedUsConnection will suit for you.
20
+ Client of polish getresponse360.pl should use GetResponse::DedicatedPlConnection.
21
+
13
22
  Test connection to GetResponse API.
14
23
 
15
24
  gr_connection = GetResponse::Connection.new("my_secret_api")
@@ -59,7 +68,6 @@ Move contact between campaigns:
59
68
  # zXy - existing campaign
60
69
  contact.move("zXy")
61
70
 
62
-
63
71
  Get geoip location
64
72
 
65
73
  # with connection
@@ -205,3 +213,14 @@ Fetching blacklisted addresses for account
205
213
  Fetching blacklisted addresses for campaign
206
214
 
207
215
  campaign.blacklist
216
+
217
+ Creating follow up message:
218
+
219
+ campaign.create_follow_up({
220
+ "subject" => "My new followup",
221
+ "day_of_cycle" => 1024,
222
+ "contents" => {
223
+ "plain" => "Hello, it is my follow up!",
224
+ "html" => "<b>Hello</b>, it is my follow up!"
225
+ }
226
+ })
@@ -26,4 +26,6 @@ GetResponse.autoload :ConfirmationSubjectProxy, "get_response/confirmation_subje
26
26
  GetResponse.autoload :Conditions, "get_response/conditions"
27
27
  GetResponse.autoload :LinksProxy, "get_response/links_proxy"
28
28
  GetResponse.autoload :Link, "get_response/link"
29
- GetResponse.autoload :Blacklist, "get_response/blacklist"
29
+ GetResponse.autoload :Blacklist, "get_response/blacklist"
30
+ GetResponse.autoload :DedicatedUsConnection, "get_response/dedicated_us_connection"
31
+ GetResponse.autoload :DedicatedPlConnection, "get_response/dedicated_pl_connection"
@@ -20,7 +20,7 @@ module GetResponse
20
20
 
21
21
  # Get all contacts assigned to this campaign.
22
22
  #
23
- # returns:: [GetResponse::Contact]
23
+ # @return [GetResponse::Contact]
24
24
  def contacts
25
25
  @contact_proxy = ContactProxy.new(@connection)
26
26
  @contact_proxy.all(:campaigns => [@id])
@@ -38,7 +38,7 @@ module GetResponse
38
38
 
39
39
  # Get domain assigned to this campaign.
40
40
  #
41
- # returns:: GetResponse::Domain
41
+ # @return [GetResponse::Domain]
42
42
  def domain
43
43
  params = {"campaign" => self.id}
44
44
  domain = @connection.send_request("get_campaign_domain", params)["result"].map do |id, attrs|
@@ -50,8 +50,8 @@ module GetResponse
50
50
 
51
51
  # Set domain for this campaign.
52
52
  #
53
- # new_domain:: GetResponse::Domain
54
- # returns:: GetResponse::Domain
53
+ # @param [GetResponse::Domain] new_domain
54
+ # @return [GetResponse::Domain]
55
55
  def domain=(new_domain)
56
56
  params = { "domain" => new_domain.id, "campaign" => self.id }
57
57
 
@@ -198,6 +198,29 @@ module GetResponse
198
198
  GetResponse::Blacklist.new(entries, @connection, self)
199
199
  end
200
200
 
201
+
202
+ # Create follow up message in campaign.
203
+ #
204
+ # Example:
205
+ #
206
+ # @campaing.create_follow_up({
207
+ # "subject" => "My new followup",
208
+ # "day_of_cycle" => 1024,
209
+ # "contents" => {
210
+ # "plain" => "Hello, it is my follow up!",
211
+ # "html" => "<b>Hello</b>, it is my follow up!"
212
+ # }
213
+ # })
214
+ #
215
+ # @param follow_up_attributes [Hash]
216
+ # @return [GetResponse::FollowUp]
217
+ def create_follow_up(follow_up_attributes)
218
+ follow_up_attributes.merge!("campaign_id" => @id)
219
+ GetResponse::FollowUp.new(follow_up_attributes, @connection).tap do |follow_up|
220
+ follow_up.save
221
+ end
222
+ end
223
+
201
224
  end
202
225
 
203
226
  end
@@ -4,7 +4,7 @@ module GetResponse
4
4
 
5
5
  # Simple class that simulates connection to service
6
6
  class Connection
7
- API_URI = "http://api2.getresponse.com"
7
+ API_URI = "http://api2.getresponse.com/"
8
8
 
9
9
  attr_reader :api_key
10
10
 
@@ -85,9 +85,10 @@ module GetResponse
85
85
  :params => [@api_key, params]
86
86
  }.to_json
87
87
 
88
- uri = URI.parse(API_URI)
88
+ uri = URI.parse(self.class::API_URI)
89
89
  resp = Net::HTTP.start(uri.host, uri.port) do |conn|
90
- conn.post("/", request_params)
90
+ puts uri.inspect
91
+ conn.post(uri.path, request_params)
91
92
  end
92
93
  raise GetResponseError.new("API key verification failed") if resp.code.to_i == 403
93
94
  raise GetResponseError.new("204 No content response received which signifies interpreting request as notification") if resp.code.to_i == 204
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ module GetResponse
4
+
5
+ # Class simulates connection to API of getresponse360.pl service.
6
+ class DedicatedPlConnection < Connection
7
+
8
+ API_URI = "http://api.getresponse360.pl/CRYPTO"
9
+
10
+ end
11
+
12
+ end
13
+
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ module GetResponse
4
+
5
+ # Class simulates connection to API of getresponse360.com service.
6
+ class DedicatedUsConnection < Connection
7
+
8
+ API_URI = "http://api.getresponse360.com/CRYPTO"
9
+
10
+ end
11
+
12
+ end
13
+
@@ -21,6 +21,20 @@ module GetResponse
21
21
  @day_of_cycle = value.to_i if response["updated"].to_i == 1
22
22
  end
23
23
 
24
+
25
+ # Save follow-up message. When object can't be saved <tt>GetResponseError</tt> is raised,
26
+ # otherwise returns <tt>true</tt>.
27
+ def save
28
+ params = {
29
+ campaign: @campaign_id,
30
+ subject: @subject,
31
+ contents: @contents,
32
+ day_of_cycle: @day_of_cycle
33
+ }
34
+ result = @connection.send_request(:add_follow_up, params)
35
+ result["added"] == 1
36
+ end
37
+
24
38
  end
25
39
 
26
40
  end
@@ -12,6 +12,8 @@ module GetResponse
12
12
  @flags = params["flags"] || []
13
13
  @created_on = params["created_on"]
14
14
  @connection = connection
15
+ @campaign_id = params["campaign_id"]
16
+ @contents = params["contents"]
15
17
  end
16
18
 
17
19
 
metadata CHANGED
@@ -1,118 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getresponse
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.5.1
4
+ version: '0.6'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sebastian Nowak
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
11
+ date: 2013-05-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- type: :runtime
14
+ name: json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.4'
20
+ type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
- none: false
25
23
  requirements:
26
24
  - - ~>
27
25
  - !ruby/object:Gem::Version
28
26
  version: '1.4'
29
- name: json
30
27
  - !ruby/object:Gem::Dependency
31
- type: :runtime
28
+ name: json_pure
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
37
33
  version: '1.4'
34
+ type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
- none: false
41
37
  requirements:
42
38
  - - ~>
43
39
  - !ruby/object:Gem::Version
44
40
  version: '1.4'
45
- name: json_pure
46
41
  - !ruby/object:Gem::Dependency
47
- type: :development
42
+ name: rr
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.0'
48
+ type: :development
54
49
  prerelease: false
55
50
  version_requirements: !ruby/object:Gem::Requirement
56
- none: false
57
51
  requirements:
58
52
  - - ~>
59
53
  - !ruby/object:Gem::Version
60
54
  version: '1.0'
61
- name: rr
62
- description: With this gem you can manage your subscribers, campaigns, messages
55
+ description: With this gem you can manage your subscribers, campaigns, messages etc.
63
56
  email: sebastian.nowak@implix.com
64
57
  executables: []
65
58
  extensions: []
66
59
  extra_rdoc_files: []
67
60
  files:
68
- - lib/get_response.rb
69
- - lib/get_response/from_field.rb
70
- - lib/get_response/confirmation_subject.rb
71
- - lib/get_response/domain_proxy.rb
72
- - lib/get_response/confirmation_subject_proxy.rb
73
- - lib/get_response/contact_proxy.rb
74
- - lib/get_response/confirmation_body_proxy.rb
75
- - lib/get_response/message_proxy.rb
76
- - lib/get_response/confirmation_body.rb
77
- - lib/get_response/newsletter.rb
78
61
  - lib/get_response/account.rb
79
- - lib/get_response/link.rb
80
- - lib/get_response/contact.rb
81
- - lib/get_response/campaign_proxy.rb
62
+ - lib/get_response/blacklist.rb
82
63
  - lib/get_response/campaign.rb
83
- - lib/get_response/message.rb
64
+ - lib/get_response/campaign_proxy.rb
65
+ - lib/get_response/conditions.rb
66
+ - lib/get_response/confirmation_body.rb
67
+ - lib/get_response/confirmation_body_proxy.rb
68
+ - lib/get_response/confirmation_subject.rb
69
+ - lib/get_response/confirmation_subject_proxy.rb
84
70
  - lib/get_response/connection.rb
71
+ - lib/get_response/contact.rb
72
+ - lib/get_response/contact_proxy.rb
73
+ - lib/get_response/dedicated_pl_connection.rb
74
+ - lib/get_response/dedicated_us_connection.rb
75
+ - lib/get_response/domain.rb
76
+ - lib/get_response/domain_proxy.rb
85
77
  - lib/get_response/follow_up.rb
86
- - lib/get_response/conditions.rb
78
+ - lib/get_response/from_field.rb
87
79
  - lib/get_response/from_fields_proxy.rb
88
- - lib/get_response/domain.rb
89
- - lib/get_response/blacklist.rb
90
- - lib/get_response/links_proxy.rb
91
80
  - lib/get_response/get_response_error.rb
92
- - lib/api.rb
81
+ - lib/get_response/link.rb
82
+ - lib/get_response/links_proxy.rb
83
+ - lib/get_response/message.rb
84
+ - lib/get_response/message_proxy.rb
85
+ - lib/get_response/newsletter.rb
86
+ - lib/get_response.rb
93
87
  - README.rdoc
94
88
  homepage: http://dev.getresponse.com
95
89
  licenses: []
90
+ metadata: {}
96
91
  post_install_message:
97
92
  rdoc_options: []
98
93
  require_paths:
99
94
  - lib
100
95
  required_ruby_version: !ruby/object:Gem::Requirement
101
- none: false
102
96
  requirements:
103
- - - ! '>='
97
+ - - '>='
104
98
  - !ruby/object:Gem::Version
105
99
  version: '0'
106
100
  required_rubygems_version: !ruby/object:Gem::Requirement
107
- none: false
108
101
  requirements:
109
- - - ! '>='
102
+ - - '>='
110
103
  - !ruby/object:Gem::Version
111
104
  version: 1.3.5
112
105
  requirements: []
113
106
  rubyforge_project:
114
- rubygems_version: 1.8.24
107
+ rubygems_version: 2.0.3
115
108
  signing_key:
116
- specification_version: 3
109
+ specification_version: 4
117
110
  summary: Ruby wrapper for GetResponse API
118
111
  test_files: []
data/lib/api.rb DELETED
@@ -1 +0,0 @@
1
- API_KEY='d333e12e5019b6940127e82b499d75a5'