chubasaweber 0.0.0

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.
Files changed (80) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +17 -0
  6. data/README.textile +65 -0
  7. data/Rakefile +53 -0
  8. data/VERSION +1 -0
  9. data/aweber.gemspec +53 -0
  10. data/chubasaweber.gemspec +144 -0
  11. data/examples/with_access_token.rb +17 -0
  12. data/examples/your_account.rb +26 -0
  13. data/lib/aweber.rb +66 -0
  14. data/lib/aweber/base.rb +57 -0
  15. data/lib/aweber/collection.rb +110 -0
  16. data/lib/aweber/oauth.rb +69 -0
  17. data/lib/aweber/resource.rb +131 -0
  18. data/lib/aweber/resources.rb +14 -0
  19. data/lib/aweber/resources/account.rb +14 -0
  20. data/lib/aweber/resources/broadcast.rb +29 -0
  21. data/lib/aweber/resources/click.rb +13 -0
  22. data/lib/aweber/resources/followup.rb +24 -0
  23. data/lib/aweber/resources/integration.rb +8 -0
  24. data/lib/aweber/resources/link.rb +12 -0
  25. data/lib/aweber/resources/list.rb +86 -0
  26. data/lib/aweber/resources/message.rb +20 -0
  27. data/lib/aweber/resources/open.rb +10 -0
  28. data/lib/aweber/resources/subscriber.rb +28 -0
  29. data/lib/aweber/resources/tracked_event.rb +13 -0
  30. data/lib/aweber/resources/web_form.rb +14 -0
  31. data/lib/aweber/resources/web_form_split_test.rb +11 -0
  32. data/lib/aweber/resources/web_form_split_test_component.rb +20 -0
  33. data/lib/chubasaweber.rb +66 -0
  34. data/spec/base_spec.rb +23 -0
  35. data/spec/collection_spec.rb +40 -0
  36. data/spec/fixtures/account.json +8 -0
  37. data/spec/fixtures/accounts.json +13 -0
  38. data/spec/fixtures/campaign.json +23 -0
  39. data/spec/fixtures/campaigns.json +106 -0
  40. data/spec/fixtures/click.json +9 -0
  41. data/spec/fixtures/clicks.json +14 -0
  42. data/spec/fixtures/integration.json +8 -0
  43. data/spec/fixtures/integrations.json +45 -0
  44. data/spec/fixtures/link.json +10 -0
  45. data/spec/fixtures/links.json +75 -0
  46. data/spec/fixtures/list.json +11 -0
  47. data/spec/fixtures/lists.json +38 -0
  48. data/spec/fixtures/message.json +12 -0
  49. data/spec/fixtures/messages.json +29 -0
  50. data/spec/fixtures/open.json +8 -0
  51. data/spec/fixtures/opens.json +21 -0
  52. data/spec/fixtures/subscriber.json +16 -0
  53. data/spec/fixtures/subscribers.json +69 -0
  54. data/spec/fixtures/tracked_event.json +8 -0
  55. data/spec/fixtures/tracked_events.json +21 -0
  56. data/spec/fixtures/web_form.json +14 -0
  57. data/spec/fixtures/web_form_split_test.json +9 -0
  58. data/spec/fixtures/web_form_split_test_component.json +16 -0
  59. data/spec/fixtures/web_form_split_test_components.json +37 -0
  60. data/spec/fixtures/web_form_split_tests.json +41 -0
  61. data/spec/fixtures/web_forms.json +229 -0
  62. data/spec/oauth_spec.rb +96 -0
  63. data/spec/resource_spec.rb +80 -0
  64. data/spec/resources/account_spec.rb +13 -0
  65. data/spec/resources/campaign_spec.rb +14 -0
  66. data/spec/resources/click_spec.rb +14 -0
  67. data/spec/resources/integration_spec.rb +13 -0
  68. data/spec/resources/link_spec.rb +15 -0
  69. data/spec/resources/list_spec.rb +26 -0
  70. data/spec/resources/message_spec.rb +17 -0
  71. data/spec/resources/open_spec.rb +13 -0
  72. data/spec/resources/subscriber_spec.rb +33 -0
  73. data/spec/resources/tracked_event_spec.rb +14 -0
  74. data/spec/resources/web_form_spec.rb +19 -0
  75. data/spec/resources/web_form_split_test_component_spec.rb +20 -0
  76. data/spec/resources/web_form_split_test_spec.rb +14 -0
  77. data/spec/spec_helper.rb +52 -0
  78. data/test/helper.rb +10 -0
  79. data/test/test_chubasaweber.rb +7 -0
  80. metadata +181 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "event_time": "2009-11-06 00:05:44-05:00",
3
+ "http_etag": "\"da39a3ee5e6b4b0d3255bfef95601890afd80709-6a4a4fd5c7d79cc2f03a65e572b6a5f1af60f1b3\"",
4
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/campaigns/f4125891/messages/11839",
5
+ "resource_type_link": "https://api.aweber.com/1.0/#tracked_event",
6
+ "type": "click",
7
+ "id": 11839
8
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "total_size": 2,
3
+ "start": 0,
4
+ "resource_type_link": "https://api.aweber.com/1.0/#tracked-event-page-resource",
5
+ "entries": [{
6
+ "event_time": "2009-11-06 00:05:44-05:00",
7
+ "http_etag": "\"da39a3ee5e6b4b0d3255bfef95601890afd80709-6a4a4fd5c7d79cc2f03a65e572b6a5f1af60f1b3\"",
8
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/campaigns/f4125891/messages/11839",
9
+ "resource_type_link": "https://api.aweber.com/1.0/#tracked_event",
10
+ "type": "click",
11
+ "id": 11839
12
+ },
13
+ {
14
+ "event_time": "2009-11-20 00:05:39-05:00",
15
+ "http_etag": "\"da39a3ee5e6b4b0d3255bfef95601890afd80709-37115b6a3e4f8ddb2079560b833e020bcfb79aac\"",
16
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/campaigns/f4125891/messages/11911",
17
+ "resource_type_link": "https://api.aweber.com/1.0/#message",
18
+ "type": "click",
19
+ "id": 11911
20
+ }]
21
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "conversion_percentage": 0.0,
3
+ "unique_conversion_percentage": 0.0,
4
+ "name": "Test Light",
5
+ "total_unique_displays": 12,
6
+ "type": "lightbox",
7
+ "is_active": true,
8
+ "total_submissions": 0,
9
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/208918171",
10
+ "http_etag": "\"be17a3eae7a396181c523ef2709acf2be037f0d8-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
11
+ "total_displays": 33,
12
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
13
+ "id": 208918171
14
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "Popover/Inline Split",
3
+ "http_etag": "\"1d59f97149248c2aa12502da7e770551029dc77c-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
4
+ "is_active": true,
5
+ "components_collection_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/612763163/components",
6
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/612763163",
7
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form_split_test",
8
+ "id": 612763163
9
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "conversion_percentage": 2.2727272727272729,
3
+ "unique_conversion_percentage": 7.1428571428571423,
4
+ "name": "Popover - display every visit",
5
+ "weight": 50,
6
+ "total_unique_displays": 14,
7
+ "type": "popover",
8
+ "is_active": true,
9
+ "total_submissions": 1,
10
+ "web_form_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1939327572",
11
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/612763163/components/612763163-1939327572",
12
+ "http_etag": "\"fb84f8d52440bb8311497758f95d27f4ad4a5e4e-e25bf3f1726a0e498b88f28f683691a1df2854c6\"",
13
+ "total_displays": 44,
14
+ "resource_type_link": "https://api.aweber.com/1.0/#component",
15
+ "id": "612763163-1939327572"
16
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "total_size": 2,
3
+ "start": 0,
4
+ "resource_type_link": "https://api.aweber.com/1.0/#component-page-resource",
5
+ "entries": [{
6
+ "conversion_percentage": 3.9215686274509802,
7
+ "unique_conversion_percentage": 7.4074074074074066,
8
+ "name": "In-Line Test",
9
+ "weight": 50,
10
+ "total_unique_displays": 27,
11
+ "type": "inline",
12
+ "is_active": true,
13
+ "total_submissions": 2,
14
+ "web_form_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/513600765",
15
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/612763163/components/612763163-513600765",
16
+ "http_etag": "\"6334a2e8cea7042acb6de99272e7105851d43d03-0d45d2b05a0e486d5e2d7ed6f071487658adb336\"",
17
+ "total_displays": 51,
18
+ "resource_type_link": "https://api.aweber.com/1.0/#component",
19
+ "id": "612763163-513600765"
20
+ },
21
+ {
22
+ "conversion_percentage": 2.2727272727272729,
23
+ "unique_conversion_percentage": 7.1428571428571423,
24
+ "name": "Popover - display every visit",
25
+ "weight": 50,
26
+ "total_unique_displays": 14,
27
+ "type": "popover",
28
+ "is_active": true,
29
+ "total_submissions": 1,
30
+ "web_form_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1939327572",
31
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/612763163/components/612763163-1939327572",
32
+ "http_etag": "\"fb84f8d52440bb8311497758f95d27f4ad4a5e4e-e25bf3f1726a0e498b88f28f683691a1df2854c6\"",
33
+ "total_displays": 44,
34
+ "resource_type_link": "https://api.aweber.com/1.0/#component",
35
+ "id": "612763163-1939327572"
36
+ }]
37
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "total_size": 4,
3
+ "start": 0,
4
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form_split_test-page-resource",
5
+ "entries": [{
6
+ "name": "sdfsdfsd",
7
+ "http_etag": "\"c72b4e37d1bd4c1e50a84021387d96f3f48bc01f-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
8
+ "is_active": false,
9
+ "components_collection_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/1242668124/components",
10
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/1242668124",
11
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form_split_test",
12
+ "id": 1242668124
13
+ },
14
+ {
15
+ "name": "My splittest",
16
+ "http_etag": "\"c377ab517b2f42aba46e0a77d28ea2a381bf4c09-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
17
+ "is_active": true,
18
+ "components_collection_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/1012223044/components",
19
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/1012223044",
20
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form_split_test",
21
+ "id": 1012223044
22
+ },
23
+ {
24
+ "name": "Split Test",
25
+ "http_etag": "\"e3b717cfe92db22ac70b822bb45adc83a42b7447-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
26
+ "is_active": true,
27
+ "components_collection_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/1470252472/components",
28
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/1470252472",
29
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form_split_test",
30
+ "id": 1470252472
31
+ },
32
+ {
33
+ "name": "Popover/Inline Split",
34
+ "http_etag": "\"1d59f97149248c2aa12502da7e770551029dc77c-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
35
+ "is_active": true,
36
+ "components_collection_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/612763163/components",
37
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_form_split_tests/612763163",
38
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form_split_test",
39
+ "id": 612763163
40
+ }]
41
+ }
@@ -0,0 +1,229 @@
1
+ {
2
+ "total_size": 16,
3
+ "start": 0,
4
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form-page-resource",
5
+ "entries": [{
6
+ "conversion_percentage": 0.0,
7
+ "unique_conversion_percentage": 0.0,
8
+ "name": "My Web Form 3",
9
+ "total_unique_displays": 1,
10
+ "type": "styled",
11
+ "is_active": true,
12
+ "total_submissions": 0,
13
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1911952229",
14
+ "http_etag": "\"740e66434631228ac7e9ec39e518f0b78615b6eb-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
15
+ "total_displays": 1,
16
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
17
+ "id": 1911952229
18
+ },
19
+ {
20
+ "conversion_percentage": 0.0,
21
+ "unique_conversion_percentage": 0.0,
22
+ "name": "Exit Popup - display every visit",
23
+ "total_unique_displays": 0,
24
+ "type": "exitpopup",
25
+ "is_active": true,
26
+ "total_submissions": 0,
27
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/132181207",
28
+ "http_etag": "\"277bd4a125e5df089f770a2990090ef075be9851-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
29
+ "total_displays": 0,
30
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
31
+ "id": 132181207
32
+ },
33
+ {
34
+ "conversion_percentage": 0.0,
35
+ "unique_conversion_percentage": 0.0,
36
+ "name": "Test Light",
37
+ "total_unique_displays": 12,
38
+ "type": "lightbox",
39
+ "is_active": true,
40
+ "total_submissions": 0,
41
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/208918171",
42
+ "http_etag": "\"be17a3eae7a396181c523ef2709acf2be037f0d8-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
43
+ "total_displays": 33,
44
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
45
+ "id": 208918171
46
+ },
47
+ {
48
+ "conversion_percentage": 2.8571428571428572,
49
+ "unique_conversion_percentage": 14.285714285714285,
50
+ "name": "In-Line Test",
51
+ "total_unique_displays": 7,
52
+ "type": "inline",
53
+ "is_active": true,
54
+ "total_submissions": 1,
55
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/513600765",
56
+ "http_etag": "\"ba9ec9ba99dd12cdab2c77cf4a581567d1c428e5-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
57
+ "total_displays": 35,
58
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
59
+ "id": 513600765
60
+ },
61
+ {
62
+ "conversion_percentage": 62.222222222222221,
63
+ "unique_conversion_percentage": 133.33333333333331,
64
+ "name": "Popup - display every visit",
65
+ "total_unique_displays": 21,
66
+ "type": "popup",
67
+ "is_active": true,
68
+ "total_submissions": 28,
69
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/647191251",
70
+ "http_etag": "\"b8d2ceaec4f33abeb8785e0b86e9031296ce2094-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
71
+ "total_displays": 45,
72
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
73
+ "id": 647191251
74
+ },
75
+ {
76
+ "conversion_percentage": 0.0,
77
+ "unique_conversion_percentage": 0.0,
78
+ "name": "Test Light (upgrade should work stage1)",
79
+ "total_unique_displays": 10,
80
+ "type": "styled",
81
+ "is_active": true,
82
+ "total_submissions": 0,
83
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/880369754",
84
+ "http_etag": "\"81257013534b27ec765126b60e8322532a263ef3-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
85
+ "total_displays": 31,
86
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
87
+ "id": 880369754
88
+ },
89
+ {
90
+ "conversion_percentage": 0.0,
91
+ "unique_conversion_percentage": 0.0,
92
+ "name": "LightboxTest",
93
+ "total_unique_displays": 10,
94
+ "type": "styled",
95
+ "is_active": true,
96
+ "total_submissions": 0,
97
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/961241624",
98
+ "http_etag": "\"e4004fdb19fe4339b9b1a5bff3ed19be951447c4-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
99
+ "total_displays": 61,
100
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
101
+ "id": 961241624
102
+ },
103
+ {
104
+ "conversion_percentage": 0.0,
105
+ "unique_conversion_percentage": 0.0,
106
+ "name": "Test Light (upgrade production)",
107
+ "total_unique_displays": 10,
108
+ "type": "styled",
109
+ "is_active": true,
110
+ "total_submissions": 0,
111
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1391192231",
112
+ "http_etag": "\"a765ec3ca480407d745827711032e5fcd7e4157c-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
113
+ "total_displays": 31,
114
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
115
+ "id": 1391192231
116
+ },
117
+ {
118
+ "conversion_percentage": 33.333333333333329,
119
+ "unique_conversion_percentage": 50.0,
120
+ "name": "Popunder - display every visit",
121
+ "total_unique_displays": 8,
122
+ "type": "popunder",
123
+ "is_active": true,
124
+ "total_submissions": 4,
125
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1749423022",
126
+ "http_etag": "\"eabdab5a1722c124ba3ed2a75c37cbf275ca31b9-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
127
+ "total_displays": 12,
128
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
129
+ "id": 1749423022
130
+ },
131
+ {
132
+ "conversion_percentage": 0.0,
133
+ "unique_conversion_percentage": 0.0,
134
+ "name": "My Web Form",
135
+ "total_unique_displays": 1,
136
+ "type": "styled",
137
+ "is_active": true,
138
+ "total_submissions": 0,
139
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1921154277",
140
+ "http_etag": "\"dab71e6152ce104125b6f40762294bb09309e5c6-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
141
+ "total_displays": 1,
142
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
143
+ "id": 1921154277
144
+ },
145
+ {
146
+ "conversion_percentage": 20.0,
147
+ "unique_conversion_percentage": 100.0,
148
+ "name": "Popover - display every visit",
149
+ "total_unique_displays": 1,
150
+ "type": "popover",
151
+ "is_active": true,
152
+ "total_submissions": 1,
153
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1939327572",
154
+ "http_etag": "\"f290d56d439512e483d384768912e6de2a43b92b-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
155
+ "total_displays": 5,
156
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
157
+ "id": 1939327572
158
+ },
159
+ {
160
+ "conversion_percentage": 0.0,
161
+ "unique_conversion_percentage": 0.0,
162
+ "name": "Test Light (legacy upgraded.)",
163
+ "total_unique_displays": 10,
164
+ "type": "styled",
165
+ "is_active": true,
166
+ "total_submissions": 0,
167
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/2046878551",
168
+ "http_etag": "\"de897ef50aea8fd3300919e3375f22ecdd381708-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
169
+ "total_displays": 31,
170
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
171
+ "id": 2046878551
172
+ },
173
+ {
174
+ "conversion_percentage": 0.0,
175
+ "unique_conversion_percentage": 0.0,
176
+ "name": "My Web Form 2",
177
+ "total_unique_displays": 4,
178
+ "type": "styled",
179
+ "is_active": true,
180
+ "total_submissions": 0,
181
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/2047103930",
182
+ "http_etag": "\"5f9a8844dd3a501988cf9045c23c050838a3bf6e-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
183
+ "total_displays": 9,
184
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
185
+ "id": 2047103930
186
+ },
187
+ {
188
+ "conversion_percentage": 0.0,
189
+ "unique_conversion_percentage": 0.0,
190
+ "name": "My Web Form 4",
191
+ "total_unique_displays": 1,
192
+ "type": "styled",
193
+ "is_active": true,
194
+ "total_submissions": 0,
195
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/164297012",
196
+ "http_etag": "\"5e3c3b5d1d836e6a74cc6dc3e4fab268b4f731a2-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
197
+ "total_displays": 1,
198
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
199
+ "id": 164297012
200
+ },
201
+ {
202
+ "conversion_percentage": 0.0,
203
+ "unique_conversion_percentage": 0.0,
204
+ "name": "My Web Form 5",
205
+ "total_unique_displays": 0,
206
+ "type": "styled",
207
+ "is_active": true,
208
+ "total_submissions": 0,
209
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1642576831",
210
+ "http_etag": "\"3a9765ef32d2575b4212d89952e5835393a1a094-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
211
+ "total_displays": 0,
212
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
213
+ "id": 1642576831
214
+ },
215
+ {
216
+ "conversion_percentage": 0.0,
217
+ "unique_conversion_percentage": 0.0,
218
+ "name": "My Web Form 6",
219
+ "total_unique_displays": 0,
220
+ "type": "styled",
221
+ "is_active": true,
222
+ "total_submissions": 0,
223
+ "self_link": "https://api.aweber.com/1.0/accounts/1/lists/406860/web_forms/1733075440",
224
+ "http_etag": "\"584f653571423fc4d2de45a964410aa4a5fd8cb7-ca5feee2b7fbb6febfca8af5541541ea960aaedb\"",
225
+ "total_displays": 0,
226
+ "resource_type_link": "https://api.aweber.com/1.0/#web_form",
227
+ "id": 1733075440
228
+ }]
229
+ }
@@ -0,0 +1,96 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe AWeber::OAuth do
4
+
5
+ it "initialize with consumer token and secret" do
6
+ aweber = AWeber::OAuth.new('token', 'secret')
7
+ aweber.consumer.key.should == 'token'
8
+ aweber.consumer.secret.should == 'secret'
9
+ end
10
+
11
+ it "should create a consumer" do
12
+ OAuth::Consumer.should_receive(:new).with('token', 'secret', {
13
+ :site => AWeber.auth_endpoint,
14
+ :request_token_path => "/1.0/oauth/request_token",
15
+ :authorize_path => "/1.0/oauth/authorize",
16
+ :access_token_path => "/1.0/oauth/access_token",
17
+ :scheme => :query_string
18
+ })
19
+
20
+ AWeber::OAuth.new('token', 'secret').consumer
21
+ end
22
+
23
+ it "should set the request token path to /1.0/oauth/request_token" do
24
+ aweber = AWeber::OAuth.new('token', 'secret')
25
+ aweber.consumer.request_token_path.should == "/1.0/oauth/request_token"
26
+ end
27
+
28
+ it "should set the authorize path to /1.0/oauth/authorize" do
29
+ aweber = AWeber::OAuth.new('token', 'secret')
30
+ aweber.consumer.authorize_path.should == "/1.0/oauth/authorize"
31
+ end
32
+
33
+ it "should set the access token path to /1.0/oauth/access_token" do
34
+ aweber = AWeber::OAuth.new('token', 'secret')
35
+ aweber.consumer.access_token_path.should == "/1.0/oauth/access_token"
36
+ end
37
+
38
+ it "should get a request token from the consumer" do
39
+ consumer = double('oauth consumer')
40
+ rtoken = double('request token')
41
+ consumer.stub(:get_request_token) { rtoken }
42
+ OAuth::Consumer.stub(:new) { consumer }
43
+
44
+ aweber = AWeber::OAuth.new('token', 'secret')
45
+ aweber.request_token.should == rtoken
46
+ end
47
+
48
+ it "should set the callback url" do
49
+ oauth = AWeber::OAuth.new('token', 'secret', :callback_url => "http://example.com")
50
+ oauth.callback_url.should == "http://example.com"
51
+ end
52
+
53
+ it "should be able to authorize with a verifier code" do
54
+ consumer = double('oauth consumer')
55
+ rtoken = double('request token')
56
+ atoken = double('access token', :token => 'fake', :secret => 'fake')
57
+
58
+ consumer.stub(:get_request_token) { rtoken }
59
+ rtoken.stub(:get_access_token) { atoken }
60
+ OAuth::Consumer.stub(:new) { consumer }
61
+ OAuth::AccessToken.stub(:new) { atoken }
62
+
63
+ rtoken.should_receive(:get_access_token).with({ :oauth_verifier => 'fake' })
64
+ aweber = AWeber::OAuth.new('token', 'secret')
65
+ aweber.authorize_with_verifier('fake')
66
+ aweber.access_token.should == atoken
67
+ end
68
+
69
+ it "should able to create access tokens from access token key and secret" do
70
+ aweber = AWeber::OAuth.new('token', 'secret')
71
+ aweber.authorize_with_access('atoken', 'asecret')
72
+
73
+ aweber.access_token.should be_an OAuth::AccessToken
74
+ aweber.access_token.token.should == 'atoken'
75
+ aweber.access_token.secret.should == 'asecret'
76
+ end
77
+
78
+ it "should delegate get to access token" do
79
+ atoken = double('access token')
80
+ aweber = AWeber::OAuth.new('token', 'secret')
81
+ aweber.stub(:access_token) { atoken }
82
+
83
+ atoken.should_receive(:get).and_return(nil)
84
+ aweber.get("/foo")
85
+ end
86
+
87
+ it "should delegate post to access token" do
88
+ atoken = double('access token')
89
+ aweber = AWeber::OAuth.new('token', 'secret')
90
+ aweber.stub(:access_token) { atoken }
91
+
92
+ atoken.should_receive(:post).and_return(nil)
93
+ aweber.post("/foo")
94
+ end
95
+
96
+ end