citygrid_api 0.0.5.1 → 0.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.
- data/.sass-cache/c6f2c767b164f077e5b9fb1f18a7886d7c755211/test.scssc +0 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +9 -1
- data/VERSION +1 -1
- data/citygrid_api.gemspec +85 -45
- data/citygrid_api.yml.backup +35 -0
- data/citygrid_api.yml.sample +35 -23
- data/fixtures/vcr_cassettes/AdGroupCriterion_mutate.yml +30 -0
- data/fixtures/vcr_cassettes/AdGroupCriterion_search.yml +35 -0
- data/fixtures/vcr_cassettes/Adding_a_place.yml +33 -0
- data/fixtures/vcr_cassettes/Call_Detail_by_campaign.yml +79 -0
- data/fixtures/vcr_cassettes/Geo.yml +32 -0
- data/fixtures/vcr_cassettes/Getting_an_offer_by_listing_ID.yml +54 -0
- data/fixtures/vcr_cassettes/Import_a_cg_account.yml +54 -0
- data/fixtures/vcr_cassettes/Initiating_a_Details.yml +133 -0
- data/fixtures/vcr_cassettes/Initiating_new_MultiDetails.yml +133 -0
- data/fixtures/vcr_cassettes/Method_of_Payment_mutate.yml +33 -0
- data/fixtures/vcr_cassettes/Method_of_Payment_search.yml +59 -0
- data/fixtures/vcr_cassettes/Mutating_AdGroup_Ads.yml +30 -0
- data/fixtures/vcr_cassettes/Report_summary_daily.yml +60 -0
- data/fixtures/vcr_cassettes/Report_summary_user_actions.yml +36 -0
- data/fixtures/vcr_cassettes/Search_Ad_Group_by_Campaign_Id.yml +31 -0
- data/fixtures/vcr_cassettes/Search_Billing_by_Campaign_Id.yml +30 -0
- data/fixtures/vcr_cassettes/Search_account_manager_by_Campaign_Id.yml +30 -0
- data/fixtures/vcr_cassettes/Searching_AdGroup_Geo.yml +57 -0
- data/fixtures/vcr_cassettes/Searching_budgets.yml +30 -0
- data/fixtures/vcr_cassettes/Searching_categories_by_listing_id.yml +35 -0
- data/fixtures/vcr_cassettes/Searching_categories_by_query.yml +33 -0
- data/fixtures/vcr_cassettes/Upload_an_image_Add_a_preview.yml +31 -0
- data/fixtures/vcr_cassettes/create_campaign.yml +30 -0
- data/fixtures/vcr_cassettes/log_in_a_session.yml +24 -0
- data/fixtures/vcr_cassettes/log_in_a_session_mutate_places.yml +56 -0
- data/fixtures/vcr_cassettes/query_account_type_by_id.yml +30 -0
- data/fixtures/vcr_cassettes/search_for_an_account_by_id.yml +31 -0
- data/fixtures/vcr_cassettes/search_for_an_account_by_name.yml +55 -0
- data/fixtures/vcr_cassettes/searching_for_a_CityGrid_listing.yml +168 -0
- data/fixtures/vcr_cassettes/searching_for_a_special_CityGrid_listing.yml +67 -0
- data/lib/citygrid/abstraction/requestable.rb +1 -0
- data/lib/citygrid/api/accounts/account.rb +17 -0
- data/lib/citygrid/api/accounts/authentication.rb +3 -0
- data/lib/citygrid/api/accounts/method_of_payment.rb +10 -0
- data/lib/citygrid/api/accounts/user.rb +18 -0
- data/lib/citygrid/api/accounts.rb +8 -0
- data/lib/citygrid/api/advertising/account_manager.rb +9 -0
- data/lib/citygrid/api/advertising/ad_group.rb +10 -0
- data/lib/citygrid/api/advertising/ad_group_ad.rb +10 -0
- data/lib/citygrid/api/advertising/ad_group_criterion.rb +10 -0
- data/lib/citygrid/api/advertising/ad_group_geo.rb +10 -0
- data/lib/citygrid/api/advertising/billing.rb +9 -0
- data/lib/citygrid/api/advertising/budget.rb +10 -0
- data/lib/citygrid/api/advertising/call_detail.rb +10 -0
- data/lib/citygrid/api/advertising/campaign.rb +10 -0
- data/lib/citygrid/api/advertising/category.rb +10 -0
- data/lib/citygrid/api/advertising/geolocation.rb +10 -0
- data/lib/citygrid/api/{ad_center → advertising}/image.rb +2 -2
- data/lib/citygrid/api/{ad_center → advertising}/performance.rb +5 -2
- data/lib/citygrid/api/advertising/places.rb +10 -0
- data/lib/citygrid/api/advertising.rb +10 -0
- data/lib/citygrid/api/content/offers.rb +2 -12
- data/lib/citygrid/api/content/places.rb +4 -26
- data/lib/citygrid/api/content.rb +1 -5
- data/lib/citygrid/api/mutatable.rb +15 -0
- data/lib/citygrid/api/searchable.rb +15 -0
- data/lib/citygrid/api.rb +54 -52
- data/lib/citygrid/details.rb +3 -6
- data/lib/citygrid/offers.rb +1 -5
- data/lib/citygrid/search.rb +3 -6
- data/lib/citygrid/session.rb +65 -0
- data/lib/citygrid.rb +46 -75
- data/lib/request_ext.rb +4 -5
- data/lib/string_ext.rb +7 -0
- data/test/api/accounts/test_account.rb +111 -0
- data/test/api/accounts/test_method_of_payment.rb +50 -0
- data/test/api/advertising/test_account_manager.rb +14 -0
- data/test/api/advertising/test_ad_group.rb +13 -0
- data/test/api/advertising/test_ad_group_ad.rb +24 -0
- data/test/api/advertising/test_ad_group_criterion.rb +47 -0
- data/test/api/{ad_center → advertising}/test_ad_group_geo.rb +1 -1
- data/test/api/{ad_center → advertising}/test_billing.rb +4 -3
- data/test/api/{ad_center → advertising}/test_budget.rb +3 -3
- data/test/api/{ad_center → advertising}/test_call_detail.rb +5 -11
- data/test/api/{ad_center → advertising}/test_category.rb +9 -12
- data/test/api/advertising/test_create_campaign_and_ad_group.rb +56 -0
- data/test/api/{ad_center → advertising}/test_geolocation.rb +1 -1
- data/test/api/{ad_center → advertising}/test_image.rb +1 -3
- data/test/api/{ad_center/test_reports.rb → advertising/test_performance.rb} +6 -10
- data/test/api/advertising/test_places.rb +109 -0
- data/test/{test_details.rb → api/content/test_details.rb} +2 -3
- data/test/{test_search.rb → api/content/test_search.rb} +2 -2
- data/test/auth_token.rb +39 -0
- data/test/helper.rb +31 -31
- data/test/session_helper.rb +20 -0
- data/test/test_session.rb +53 -0
- metadata +115 -67
- data/lib/citygrid/api/ad_center/account.rb +0 -26
- data/lib/citygrid/api/ad_center/account_manager.rb +0 -8
- data/lib/citygrid/api/ad_center/ad_group.rb +0 -8
- data/lib/citygrid/api/ad_center/ad_group_ad.rb +0 -8
- data/lib/citygrid/api/ad_center/ad_group_criterion.rb +0 -8
- data/lib/citygrid/api/ad_center/ad_group_geo.rb +0 -8
- data/lib/citygrid/api/ad_center/authentication.rb +0 -20
- data/lib/citygrid/api/ad_center/billing.rb +0 -8
- data/lib/citygrid/api/ad_center/budget.rb +0 -9
- data/lib/citygrid/api/ad_center/call_detail.rb +0 -25
- data/lib/citygrid/api/ad_center/campaign.rb +0 -8
- data/lib/citygrid/api/ad_center/category.rb +0 -9
- data/lib/citygrid/api/ad_center/geolocation.rb +0 -9
- data/lib/citygrid/api/ad_center/method_of_payment.rb +0 -10
- data/lib/citygrid/api/ad_center/places.rb +0 -8
- data/lib/citygrid/api/ad_center/user.rb +0 -8
- data/lib/citygrid/api/ad_center.rb +0 -20
- data/lib/citygrid/api/content/places/detail.rb +0 -11
- data/lib/citygrid/api/content/places/search.rb +0 -11
- data/test/api/ad_center/test_account.rb +0 -120
- data/test/api/ad_center/test_ad_group.rb +0 -50
- data/test/api/ad_center/test_ad_group_ad.rb +0 -27
- data/test/api/ad_center/test_ad_group_criterion.rb +0 -37
- data/test/api/ad_center/test_authentication.rb +0 -22
- data/test/api/ad_center/test_campaign.rb +0 -27
- data/test/api/ad_center/test_method_of_payment.rb +0 -51
- data/test/api/ad_center/test_places.rb +0 -79
- data/test/api/content/test_places.rb +0 -66
@@ -0,0 +1,111 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "search for an account" do
|
4
|
+
context "by name" do
|
5
|
+
setup do
|
6
|
+
run_with_rescue do
|
7
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Accounts::Account,
|
8
|
+
:search,
|
9
|
+
:userName => '25-1'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
should("not be empty"){ !topic.empty? }
|
13
|
+
should("return message OK"){ topic.accountList.first.response.message }.equals("OK")
|
14
|
+
should("return response code OK"){ topic.accountList.first.response.code.to_i }.equals(200)
|
15
|
+
end
|
16
|
+
|
17
|
+
context "by id" do
|
18
|
+
setup do
|
19
|
+
run_with_rescue do
|
20
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Accounts::Account,
|
21
|
+
:search,
|
22
|
+
:id => 1250702
|
23
|
+
end
|
24
|
+
end
|
25
|
+
should("not be empty"){ !topic.empty? }
|
26
|
+
should("return message OK"){ topic.accountList.first.response.message }.equals("OK")
|
27
|
+
should("return response code OK"){ topic.accountList.first.response.code.to_i }.equals(200)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "query account type" do
|
32
|
+
context "by id" do
|
33
|
+
setup do
|
34
|
+
run_with_rescue do
|
35
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Accounts::Account,
|
36
|
+
:account_type,
|
37
|
+
:id => 1250702
|
38
|
+
end
|
39
|
+
end
|
40
|
+
should("not be empty"){ !topic.empty? }
|
41
|
+
should("return message OK"){ topic.response.message }.equals("OK")
|
42
|
+
should("return response code OK"){ topic.response.code.to_i }.equals(200)
|
43
|
+
should("return type s CYB code OK"){ topic.accountType }.equals("CYB")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "import a cg account" do
|
48
|
+
setup do
|
49
|
+
run_with_rescue do
|
50
|
+
SessionHelper.gary_test.call_api CityGrid::API::Accounts::Account,
|
51
|
+
:import_to_cg,
|
52
|
+
"mutateOperationListResource" => [{
|
53
|
+
"operator" => "ADD",
|
54
|
+
"operand" => {
|
55
|
+
"firstName" => "nico-api",
|
56
|
+
"lastName" => "gomez-api",
|
57
|
+
"phone" => "9001111112",
|
58
|
+
"businessName" =>"businessProveApi",
|
59
|
+
"address1" =>"dir-api",
|
60
|
+
"city" =>"montevideo",
|
61
|
+
"state" =>"Montevideo",
|
62
|
+
"zipCode" =>"90069"
|
63
|
+
}
|
64
|
+
}]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
should("not be empty"){ !topic.empty? }
|
68
|
+
should("return message OK"){ topic.accountList.first.response.message }.equals("OK")
|
69
|
+
should("return response code OK"){ topic.accountList.first.response.code.to_i }.equals(200)
|
70
|
+
end
|
71
|
+
|
72
|
+
context "create an account" do
|
73
|
+
set :vcr, false
|
74
|
+
|
75
|
+
username = "randuser_#{rand(10000000)}"
|
76
|
+
password = "randuserpass"
|
77
|
+
|
78
|
+
setup do
|
79
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Accounts::Account,
|
80
|
+
:mutate,
|
81
|
+
"mutateOperationListResource" => [{
|
82
|
+
"operator" => "ADD",
|
83
|
+
"operand" => {
|
84
|
+
"firstName" => "nico-api",
|
85
|
+
"lastName" => "gomez-api",
|
86
|
+
"phone" => "9001111112",
|
87
|
+
"email" => "#{username}@a.com",
|
88
|
+
"userName" => username,
|
89
|
+
"password" => password,
|
90
|
+
"businessName" => "businessProveApi",
|
91
|
+
"address1" => "dir-api",
|
92
|
+
"city" => "montevideo",
|
93
|
+
"state" => "Montevideo",
|
94
|
+
"zipCode" => "90069"
|
95
|
+
}
|
96
|
+
}]
|
97
|
+
end
|
98
|
+
should("not be empty"){ !topic.empty? }
|
99
|
+
should("return message OK"){ topic.accountList.first.response.message }.equals("OK")
|
100
|
+
should("return response code OK"){ topic.accountList.first.response.code.to_i }.equals(200)
|
101
|
+
|
102
|
+
context "then logging in" do
|
103
|
+
setup do
|
104
|
+
CityGrid.login :username => username, :password => password
|
105
|
+
end
|
106
|
+
should("return an authToken"){ topic.authToken }
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "Method of Payment" do
|
4
|
+
context "search" do
|
5
|
+
setup do
|
6
|
+
run_with_rescue do
|
7
|
+
SessionHelper.kunimom.call_api CityGrid::API::Accounts::MethodOfPayment,
|
8
|
+
:search,
|
9
|
+
:accountId => 111
|
10
|
+
end
|
11
|
+
end
|
12
|
+
should("not be empty"){ !topic.empty?}
|
13
|
+
should("have MOP resources"){ !topic.mopResources.empty? }
|
14
|
+
end
|
15
|
+
|
16
|
+
# API not working here
|
17
|
+
context "mutate" do
|
18
|
+
setup do
|
19
|
+
run_with_rescue do
|
20
|
+
SessionHelper.kunimom.call_api CityGrid::API::Accounts::MethodOfPayment,
|
21
|
+
:mutate,
|
22
|
+
"mutateOperationListResource" => [{
|
23
|
+
"operator" => "ADD",
|
24
|
+
"operand" => {
|
25
|
+
"cardNumber" => "4112344112344113",
|
26
|
+
"expirationMonth" => 12,
|
27
|
+
"expirationYear" => 2012,
|
28
|
+
"nameOnAccount" => "Ara Tatous",
|
29
|
+
"cardType" => "Visa",
|
30
|
+
"state" => "NY" ,
|
31
|
+
"description" => "test addMOP",
|
32
|
+
"firstName" => "Ara",
|
33
|
+
"lastName" => "Tatous",
|
34
|
+
"phoneNumber" => "4252838811",
|
35
|
+
"address1" => "3131 Montrose Ave",
|
36
|
+
"address2" => "Apt. 9",
|
37
|
+
"city" => "LaCrescenta",
|
38
|
+
"postalCode" => "10016",
|
39
|
+
"accountId" => 2458392,
|
40
|
+
"securityCode" => "719",
|
41
|
+
"paymentType" => "Credit Card"
|
42
|
+
}
|
43
|
+
}]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
should("not be empty"){ !topic.empty? }
|
47
|
+
should("return code OK"){ topic.resources.first.response.code }.equals(200)
|
48
|
+
should("return message OK") { topic.resources.first.response.message }.equals("OK")
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "Search account manager by Campaign Id" do
|
4
|
+
setup do
|
5
|
+
run_with_rescue do
|
6
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::AccountManager,
|
7
|
+
:search,
|
8
|
+
:campaignId => 16631
|
9
|
+
end
|
10
|
+
end
|
11
|
+
should("not be empty"){ !topic.empty? }
|
12
|
+
should("have a first name"){ !topic.firstName.nil? }
|
13
|
+
should("have a last name"){ !topic.lastName.nil? }
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "Search Ad Group by Campaign Id" do
|
4
|
+
setup do
|
5
|
+
run_with_rescue do
|
6
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::AdGroup,
|
7
|
+
:search,
|
8
|
+
:campaignId => 2434702
|
9
|
+
end
|
10
|
+
end
|
11
|
+
should("not be empty"){ !topic.empty? }
|
12
|
+
should("have campaignId"){ !topic.adGroups.first.campaignId.nil? }
|
13
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "Mutating AdGroup Ads" do
|
4
|
+
setup do
|
5
|
+
run_with_rescue do
|
6
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::AdGroupAd,
|
7
|
+
:mutate,
|
8
|
+
"mutateOperationListResource" => [{
|
9
|
+
"operator" => "ADD",
|
10
|
+
"operand" => {
|
11
|
+
"groupId" => "2861",
|
12
|
+
"ad"=>{
|
13
|
+
"type" =>"PERFORMANCE_AD",
|
14
|
+
"tagline" => "myTagline",
|
15
|
+
"imageUrl" => "http://some_url.com"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
should("not be empty"){ !topic.empty? }
|
22
|
+
should("return code OK"){ topic.adGroupAds.first.response.code }.equals(200)
|
23
|
+
should("return message OK") { topic.adGroupAds.first.response.message }.equals("OK")
|
24
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "AdGroupCriterion" do
|
4
|
+
context "search" do
|
5
|
+
setup do
|
6
|
+
run_with_rescue do
|
7
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::AdGroupCriterion,
|
8
|
+
:search,
|
9
|
+
:adGroupId => 6
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
should("not be empty?"){ !topic.empty? }
|
14
|
+
should("return code OK"){ topic.adGroupCriterions.first.response.code }.equals(200)
|
15
|
+
should("return message OK") { topic.adGroupCriterions.first.response.message }.equals("OK")
|
16
|
+
end
|
17
|
+
|
18
|
+
context "mutate" do
|
19
|
+
setup do
|
20
|
+
run_with_rescue do
|
21
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::AdGroupCriterion,
|
22
|
+
:mutate,
|
23
|
+
"mutateOperationListResource" => [{
|
24
|
+
"operator" => "ADD",
|
25
|
+
"operand" => {
|
26
|
+
"adGroupId" => "2",
|
27
|
+
"adGroupAdId" => "1",
|
28
|
+
"adGroupCriterionId" =>
|
29
|
+
"1722",
|
30
|
+
"type" => "2"
|
31
|
+
}
|
32
|
+
}, {
|
33
|
+
"operator" => "REMOVE",
|
34
|
+
"operand" => {
|
35
|
+
"adGroupId" => "2",
|
36
|
+
"adGroupAdId" => "1",
|
37
|
+
"adGroupCriterionId" => "1722",
|
38
|
+
"type" => "2"
|
39
|
+
}
|
40
|
+
}]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
should("not be empty"){ !topic.empty? }
|
44
|
+
should("return code OK"){ topic.adGroupCriterions.first.response.code }.equals(200)
|
45
|
+
should("return message OK") { topic.adGroupCriterions.first.response.message }.equals("OK")
|
46
|
+
end
|
47
|
+
end
|
@@ -3,7 +3,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper')
|
|
3
3
|
context "Searching AdGroup Geo" do
|
4
4
|
setup do
|
5
5
|
run_with_rescue do
|
6
|
-
CityGrid::API::
|
6
|
+
CityGrid::API::Advertising::AdGroupGeo.search(
|
7
7
|
:token => AuthToken.sales_coord,
|
8
8
|
"adGroupId" => 78,
|
9
9
|
"streetAddress" => "200 Robertson Blvd",
|
@@ -1,14 +1,15 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
2
|
|
3
|
-
|
4
3
|
context "Search Billing by Campaign Id" do
|
5
4
|
setup do
|
6
5
|
run_with_rescue do
|
7
|
-
CityGrid::API::
|
6
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::Billing,
|
7
|
+
:search,
|
8
|
+
:campaignId => 16631
|
8
9
|
end
|
9
10
|
end
|
10
11
|
should("not be empty"){ !topic.empty? }
|
11
|
-
should("have campaignId"){ !topic.campaignId.nil? }
|
12
|
+
should("have campaignId"){ !topic.billing.campaignId.nil? }
|
12
13
|
end
|
13
14
|
|
14
15
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
2
|
|
3
|
-
token = AuthToken.generate
|
4
|
-
|
5
3
|
context "Searching budgets" do
|
6
4
|
setup do
|
7
5
|
run_with_rescue do
|
8
|
-
CityGrid::API::
|
6
|
+
SessionHelper.kunimom.call_api CityGrid::API::Advertising::Budget,
|
7
|
+
:search,
|
8
|
+
:listingId => 833372
|
9
9
|
end
|
10
10
|
end
|
11
11
|
should("not be empty"){ !topic.empty? }
|
@@ -1,18 +1,12 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
2
|
|
3
|
-
token = AuthToken.sales_coord
|
4
|
-
|
5
3
|
context "Call Detail" do
|
6
4
|
context "by campaign" do
|
7
5
|
setup do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
:period => 'last30Days',
|
13
|
-
:token => token
|
14
|
-
)
|
15
|
-
end
|
6
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::CallDetail,
|
7
|
+
:campaign,
|
8
|
+
:campaignId => 786,
|
9
|
+
:period => 'last30Days'
|
16
10
|
end
|
17
11
|
should("not be empty"){ !topic.empty? }
|
18
12
|
should("have call detail resources"){
|
@@ -23,7 +17,7 @@ context "Call Detail" do
|
|
23
17
|
# context "note" do
|
24
18
|
# setup do
|
25
19
|
# run_with_rescue do
|
26
|
-
# CityGrid::API::
|
20
|
+
# CityGrid::API::Advertising::CallDetail.note(
|
27
21
|
# :campaignId => 786,
|
28
22
|
# :period => 'last30Days',
|
29
23
|
# :token => token
|
@@ -1,37 +1,34 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
2
|
|
3
|
-
token = AuthToken.generate
|
4
|
-
|
5
3
|
context "Searching categories" do
|
6
4
|
context "by listing id" do
|
7
5
|
setup do
|
8
6
|
run_with_rescue do
|
9
|
-
CityGrid::API::
|
10
|
-
:
|
7
|
+
SessionHelper.kunimom.call_api CityGrid::API::Advertising::Category,
|
8
|
+
:search,
|
11
9
|
:listingId => 3680332,
|
12
10
|
:startIndex => 0,
|
13
11
|
:numberResults => 10
|
14
|
-
)
|
15
12
|
end
|
16
13
|
end
|
17
14
|
should("not be empty"){ !topic.empty? }
|
18
|
-
should("respond with OK"){ topic.response.code
|
19
|
-
should("have resources"){ !topic.
|
15
|
+
should("respond with OK"){ topic.response.code }.equals(200)
|
16
|
+
should("have resources"){ !topic.categories.empty? }
|
20
17
|
end
|
21
18
|
|
22
19
|
context "by query" do
|
23
20
|
setup do
|
24
21
|
run_with_rescue do
|
25
|
-
CityGrid::API::
|
22
|
+
SessionHelper.kunimom.call_api CityGrid::API::Advertising::Category,
|
23
|
+
:search,
|
26
24
|
:keywords => "pizza",
|
27
25
|
:startIndex => 0,
|
28
26
|
:numberResults => 10,
|
29
|
-
:token => token
|
30
|
-
)
|
31
27
|
end
|
32
28
|
end
|
33
29
|
should("not be empty"){ !topic.empty? }
|
34
|
-
|
35
|
-
should("
|
30
|
+
|
31
|
+
should("respond with OK"){ topic.response.code }.equals(200)
|
32
|
+
should("have resources"){ !topic.categories.empty? }
|
36
33
|
end
|
37
34
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "create campaign" do
|
4
|
+
setup do
|
5
|
+
SessionHelper.kunimom.call_api CityGrid::API::Advertising::Campaign,
|
6
|
+
:mutate,
|
7
|
+
:mutateOperationListResource => [{
|
8
|
+
:operator => "ADD",
|
9
|
+
:operand => {
|
10
|
+
:name => "PleaseWork6",
|
11
|
+
:startDate => (Date.today+1).to_s.gsub("-", ""),
|
12
|
+
:endDate => (Date.today + 10).to_s.gsub("-", ""),
|
13
|
+
:product => "PERFORMANCE",
|
14
|
+
:budget => {:amount => 30000},
|
15
|
+
:mopId => 386742
|
16
|
+
}
|
17
|
+
}]
|
18
|
+
end
|
19
|
+
|
20
|
+
should("not be empty"){ !topic.empty? }
|
21
|
+
should("return code OK"){ topic.campaigns.first.response.code }.equals(200)
|
22
|
+
should("return message OK") { topic.campaigns.first.response.message }.equals("OK")
|
23
|
+
|
24
|
+
context "then create ad_group belonging to campaign" do
|
25
|
+
setup do
|
26
|
+
SessionHelper.kunimom.call_api CityGrid::API::Advertising::AdGroup,
|
27
|
+
:mutate,
|
28
|
+
"mutateOperationListResource" => [{
|
29
|
+
"operator" => "ADD",
|
30
|
+
"operand" => {
|
31
|
+
"placeId" => "10728522",
|
32
|
+
"campaignId" => topic.campaigns.first.id,
|
33
|
+
"contractTermMonths" =>"12",
|
34
|
+
"monthlyServiceFee" => "19.95",
|
35
|
+
"bids" => [{
|
36
|
+
"actionTargetName" => "map & directions",
|
37
|
+
"ppe" => "1.80"
|
38
|
+
}]
|
39
|
+
}
|
40
|
+
}]
|
41
|
+
end
|
42
|
+
should("not be empty"){ !topic.empty? }
|
43
|
+
should("have campaignId"){ !topic.adGroups.first.campaignId.nil? }
|
44
|
+
|
45
|
+
context "then search for ad_group belonging to the user" do
|
46
|
+
setup do
|
47
|
+
SessionHelper.kunimom.call_api CityGrid::API::Advertising::AdGroup,
|
48
|
+
:search,
|
49
|
+
:adGroupIds => topic.adGroups.first.id
|
50
|
+
end
|
51
|
+
should("not be empty"){ !topic.empty? }
|
52
|
+
should("have campaignId"){ !topic.adGroups.first.campaignId.nil? }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -3,7 +3,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper')
|
|
3
3
|
context "Geo" do
|
4
4
|
setup do
|
5
5
|
run_with_rescue do
|
6
|
-
CityGrid::API::
|
6
|
+
CityGrid::API::Advertising::GeoLocation.search(
|
7
7
|
"streetAddress" => "720 3rd ave",
|
8
8
|
"city" => "seattle",
|
9
9
|
"state" => "wa",
|
@@ -5,9 +5,7 @@ context "Upload an image" do
|
|
5
5
|
setup do
|
6
6
|
run_with_rescue do
|
7
7
|
image_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_img.jpg'))
|
8
|
-
|
9
|
-
ap resp
|
10
|
-
resp
|
8
|
+
CityGrid::API::Advertising::Image.upload(68, "a pic", "PROFILE_IMAGE", image_path, :token => AuthToken.sales_coord)
|
11
9
|
end
|
12
10
|
end
|
13
11
|
should("not be empty"){ !topic.empty? }
|
@@ -1,19 +1,16 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
2
|
|
3
|
-
token = AuthToken.sales_coord
|
4
|
-
|
5
3
|
context "Report summary" do
|
6
4
|
context "daily" do
|
7
5
|
setup do
|
8
6
|
run_with_rescue do
|
9
|
-
CityGrid::API::
|
7
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::Performance,
|
10
8
|
:daily,
|
11
9
|
:campaignId => 786,
|
12
|
-
:period => 'last30Days'
|
13
|
-
:token => token
|
14
|
-
)
|
10
|
+
:period => 'last30Days'
|
15
11
|
end
|
16
12
|
end
|
13
|
+
|
17
14
|
should("not be empty"){ !topic.empty? }
|
18
15
|
should("have performance resources"){
|
19
16
|
topic.dailyCampaignPerformanceResources.length > 0
|
@@ -23,14 +20,13 @@ context "Report summary" do
|
|
23
20
|
context "user actions" do
|
24
21
|
setup do
|
25
22
|
run_with_rescue do
|
26
|
-
CityGrid::API::
|
23
|
+
SessionHelper.sales_coord.call_api CityGrid::API::Advertising::Performance,
|
27
24
|
:actions,
|
28
25
|
:campaignId => 786,
|
29
|
-
:period => 'last30Days'
|
30
|
-
:token => token
|
31
|
-
)
|
26
|
+
:period => 'last30Days'
|
32
27
|
end
|
33
28
|
end
|
29
|
+
|
34
30
|
should("not be empty"){ !topic.empty? }
|
35
31
|
should("have user actions"){ topic.userActions.length > 0 }
|
36
32
|
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
|
+
|
3
|
+
context "Adding a place" do
|
4
|
+
setup do
|
5
|
+
run_with_rescue do
|
6
|
+
SessionHelper.gary_test.call_api CityGrid::API::Advertising::Places,
|
7
|
+
:mutate,
|
8
|
+
"mutateOperationListResource" => [{
|
9
|
+
"operator" => "ADD",
|
10
|
+
"operand" => {
|
11
|
+
"name" => "Pi on sunset in LAAAAAAAAAAAAAA",
|
12
|
+
"address_1" => "Jackson 2102",
|
13
|
+
"address_2" => "",
|
14
|
+
"city" => "Los Angeles",
|
15
|
+
"state" => "California",
|
16
|
+
"postal_code" => 90025,
|
17
|
+
"phone_number" => 3103333333,
|
18
|
+
"website_url" => "pi.com",
|
19
|
+
"primary_tag_id" => "3623",
|
20
|
+
"bullet1" => "Knoll bullet 1",
|
21
|
+
"tagline" => "my tagline",
|
22
|
+
"primary_tag_id" => 3623,
|
23
|
+
"secondary_tags" => '1776'
|
24
|
+
}
|
25
|
+
}]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
should("not be empty") { !topic.empty? }
|
30
|
+
should("return code OK") { topic.resources.first.response.code }.equals(200)
|
31
|
+
should("return message OK") { topic.resources.first.response.message }.equals("OK")
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# context "Adding a place" do
|
36
|
+
# setup do
|
37
|
+
# run_with_rescue do
|
38
|
+
# CityGrid::API::Advertising::Places.search(
|
39
|
+
# :token => AuthToken.dou,
|
40
|
+
# "placeId" => 11489139
|
41
|
+
# )
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# should("not be empty") { !topic.empty? }
|
46
|
+
# should("return code OK") { topic.response.code }.equals(200)
|
47
|
+
# should("return message OK") { topic.response.message }.equals("OK")
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# context "Adding a place by Adcenter API" do
|
51
|
+
# setup do
|
52
|
+
# run_with_rescue do
|
53
|
+
# CityGrid::API::Advertising::Places.mutate(
|
54
|
+
# :token => AuthToken.dou,
|
55
|
+
# "mutateOperationListResource" => [{
|
56
|
+
# "operator" => "ADD",
|
57
|
+
# "operand" => {
|
58
|
+
# "name" => "Pi on sunset in LAAAAAAAAAAAAAA",
|
59
|
+
# "address_1" => "Jackson 2102",
|
60
|
+
# "address_2" => "",
|
61
|
+
# "city" => "Los Angeles",
|
62
|
+
# "state" => "California",
|
63
|
+
# "postal_code" => 90025,
|
64
|
+
# "phone_number" => 3103333333,
|
65
|
+
# "website_url" => "pi.com",
|
66
|
+
# "primary_tag_id" => "3623",
|
67
|
+
# "bullet1" => "Knoll bullet 1",
|
68
|
+
# "tagline" => "my tagline",
|
69
|
+
# "primary_tag_id" => 3623,
|
70
|
+
# "secondary_tags" => '1776'}
|
71
|
+
# }]
|
72
|
+
# )
|
73
|
+
# end
|
74
|
+
# end
|
75
|
+
# should("not be empty") { !topic.empty? }
|
76
|
+
# should("return code OK") { topic.resources.first.response.code }.equals(200)
|
77
|
+
# should("return message OK") { topic.resources.first.response.message.upcase }.equals("OK")
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# context "Update a place by Adcenter API" do
|
81
|
+
# setup do
|
82
|
+
# run_with_rescue do
|
83
|
+
# CityGrid::API::Advertising::Places.mutate(
|
84
|
+
# :token => AuthToken.dou,
|
85
|
+
# "mutateOperationListResource" => [{
|
86
|
+
# "operator" => "SET",
|
87
|
+
# "operand" => {
|
88
|
+
# "name" => "Pi on sunset in LAAAAAAAAAAAAAA",
|
89
|
+
# "address_1" => "Jackson 2102",
|
90
|
+
# "address_2" => "",
|
91
|
+
# "city" => "Los Angeles",
|
92
|
+
# "state" => "California",
|
93
|
+
# "postal_code" => 90025,
|
94
|
+
# "phone_number" => 3103333333,
|
95
|
+
# "website_url" => "pi.com",
|
96
|
+
# "primary_tag_id" => "3623",
|
97
|
+
# "bullet1" => "Knoll bullet 1",
|
98
|
+
# "tagline" => "my tagline",
|
99
|
+
# "primary_tag_id" => 3623,
|
100
|
+
# "secondary_tags" => '1776',
|
101
|
+
# "listing_id" => 755498442}
|
102
|
+
# }]
|
103
|
+
# )
|
104
|
+
# end
|
105
|
+
# end
|
106
|
+
# should("not be empty"){ !topic.empty? }
|
107
|
+
# should("return code OK"){ topic.resources.first.response.code }.equals(200)
|
108
|
+
# should("return message OK") { topic.resources.first.response.message }.equals("OK")
|
109
|
+
# end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
2
|
|
3
|
-
|
3
|
+
context "Initiating a Details" do
|
4
4
|
setup do
|
5
5
|
begin
|
6
6
|
run_with_rescue do
|
@@ -14,7 +14,6 @@ c = context "Initiating a Details" do
|
|
14
14
|
should "return a single Details object" do
|
15
15
|
topic.is_a? CityGrid::Details
|
16
16
|
end
|
17
|
-
|
18
17
|
end
|
19
18
|
|
20
19
|
context "Initiating new MultiDetails" do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
|
2
2
|
|
3
3
|
context "searching for a CityGrid listing" do
|
4
4
|
setup do
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
|
23
23
|
context "searching for a special CityGrid listing" do
|
24
24
|
setup do
|
25
|
-
CityGrid.search :what => "
|
25
|
+
CityGrid.search :what => "el gaucho", :where => "seattle, wa"
|
26
26
|
end
|
27
27
|
|
28
28
|
should "create an array" do
|