citygrid_api 0.0.5.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/.sass-cache/c6f2c767b164f077e5b9fb1f18a7886d7c755211/test.scssc +0 -0
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +9 -1
  4. data/VERSION +1 -1
  5. data/citygrid_api.gemspec +85 -45
  6. data/citygrid_api.yml.backup +35 -0
  7. data/citygrid_api.yml.sample +35 -23
  8. data/fixtures/vcr_cassettes/AdGroupCriterion_mutate.yml +30 -0
  9. data/fixtures/vcr_cassettes/AdGroupCriterion_search.yml +35 -0
  10. data/fixtures/vcr_cassettes/Adding_a_place.yml +33 -0
  11. data/fixtures/vcr_cassettes/Call_Detail_by_campaign.yml +79 -0
  12. data/fixtures/vcr_cassettes/Geo.yml +32 -0
  13. data/fixtures/vcr_cassettes/Getting_an_offer_by_listing_ID.yml +54 -0
  14. data/fixtures/vcr_cassettes/Import_a_cg_account.yml +54 -0
  15. data/fixtures/vcr_cassettes/Initiating_a_Details.yml +133 -0
  16. data/fixtures/vcr_cassettes/Initiating_new_MultiDetails.yml +133 -0
  17. data/fixtures/vcr_cassettes/Method_of_Payment_mutate.yml +33 -0
  18. data/fixtures/vcr_cassettes/Method_of_Payment_search.yml +59 -0
  19. data/fixtures/vcr_cassettes/Mutating_AdGroup_Ads.yml +30 -0
  20. data/fixtures/vcr_cassettes/Report_summary_daily.yml +60 -0
  21. data/fixtures/vcr_cassettes/Report_summary_user_actions.yml +36 -0
  22. data/fixtures/vcr_cassettes/Search_Ad_Group_by_Campaign_Id.yml +31 -0
  23. data/fixtures/vcr_cassettes/Search_Billing_by_Campaign_Id.yml +30 -0
  24. data/fixtures/vcr_cassettes/Search_account_manager_by_Campaign_Id.yml +30 -0
  25. data/fixtures/vcr_cassettes/Searching_AdGroup_Geo.yml +57 -0
  26. data/fixtures/vcr_cassettes/Searching_budgets.yml +30 -0
  27. data/fixtures/vcr_cassettes/Searching_categories_by_listing_id.yml +35 -0
  28. data/fixtures/vcr_cassettes/Searching_categories_by_query.yml +33 -0
  29. data/fixtures/vcr_cassettes/Upload_an_image_Add_a_preview.yml +31 -0
  30. data/fixtures/vcr_cassettes/create_campaign.yml +30 -0
  31. data/fixtures/vcr_cassettes/log_in_a_session.yml +24 -0
  32. data/fixtures/vcr_cassettes/log_in_a_session_mutate_places.yml +56 -0
  33. data/fixtures/vcr_cassettes/query_account_type_by_id.yml +30 -0
  34. data/fixtures/vcr_cassettes/search_for_an_account_by_id.yml +31 -0
  35. data/fixtures/vcr_cassettes/search_for_an_account_by_name.yml +55 -0
  36. data/fixtures/vcr_cassettes/searching_for_a_CityGrid_listing.yml +168 -0
  37. data/fixtures/vcr_cassettes/searching_for_a_special_CityGrid_listing.yml +67 -0
  38. data/lib/citygrid/abstraction/requestable.rb +1 -0
  39. data/lib/citygrid/api/accounts/account.rb +17 -0
  40. data/lib/citygrid/api/accounts/authentication.rb +3 -0
  41. data/lib/citygrid/api/accounts/method_of_payment.rb +10 -0
  42. data/lib/citygrid/api/accounts/user.rb +18 -0
  43. data/lib/citygrid/api/accounts.rb +8 -0
  44. data/lib/citygrid/api/advertising/account_manager.rb +9 -0
  45. data/lib/citygrid/api/advertising/ad_group.rb +10 -0
  46. data/lib/citygrid/api/advertising/ad_group_ad.rb +10 -0
  47. data/lib/citygrid/api/advertising/ad_group_criterion.rb +10 -0
  48. data/lib/citygrid/api/advertising/ad_group_geo.rb +10 -0
  49. data/lib/citygrid/api/advertising/billing.rb +9 -0
  50. data/lib/citygrid/api/advertising/budget.rb +10 -0
  51. data/lib/citygrid/api/advertising/call_detail.rb +10 -0
  52. data/lib/citygrid/api/advertising/campaign.rb +10 -0
  53. data/lib/citygrid/api/advertising/category.rb +10 -0
  54. data/lib/citygrid/api/advertising/geolocation.rb +10 -0
  55. data/lib/citygrid/api/{ad_center → advertising}/image.rb +2 -2
  56. data/lib/citygrid/api/{ad_center → advertising}/performance.rb +5 -2
  57. data/lib/citygrid/api/advertising/places.rb +10 -0
  58. data/lib/citygrid/api/advertising.rb +10 -0
  59. data/lib/citygrid/api/content/offers.rb +2 -12
  60. data/lib/citygrid/api/content/places.rb +4 -26
  61. data/lib/citygrid/api/content.rb +1 -5
  62. data/lib/citygrid/api/mutatable.rb +15 -0
  63. data/lib/citygrid/api/searchable.rb +15 -0
  64. data/lib/citygrid/api.rb +54 -52
  65. data/lib/citygrid/details.rb +3 -6
  66. data/lib/citygrid/offers.rb +1 -5
  67. data/lib/citygrid/search.rb +3 -6
  68. data/lib/citygrid/session.rb +65 -0
  69. data/lib/citygrid.rb +46 -75
  70. data/lib/request_ext.rb +4 -5
  71. data/lib/string_ext.rb +7 -0
  72. data/test/api/accounts/test_account.rb +111 -0
  73. data/test/api/accounts/test_method_of_payment.rb +50 -0
  74. data/test/api/advertising/test_account_manager.rb +14 -0
  75. data/test/api/advertising/test_ad_group.rb +13 -0
  76. data/test/api/advertising/test_ad_group_ad.rb +24 -0
  77. data/test/api/advertising/test_ad_group_criterion.rb +47 -0
  78. data/test/api/{ad_center → advertising}/test_ad_group_geo.rb +1 -1
  79. data/test/api/{ad_center → advertising}/test_billing.rb +4 -3
  80. data/test/api/{ad_center → advertising}/test_budget.rb +3 -3
  81. data/test/api/{ad_center → advertising}/test_call_detail.rb +5 -11
  82. data/test/api/{ad_center → advertising}/test_category.rb +9 -12
  83. data/test/api/advertising/test_create_campaign_and_ad_group.rb +56 -0
  84. data/test/api/{ad_center → advertising}/test_geolocation.rb +1 -1
  85. data/test/api/{ad_center → advertising}/test_image.rb +1 -3
  86. data/test/api/{ad_center/test_reports.rb → advertising/test_performance.rb} +6 -10
  87. data/test/api/advertising/test_places.rb +109 -0
  88. data/test/{test_details.rb → api/content/test_details.rb} +2 -3
  89. data/test/{test_search.rb → api/content/test_search.rb} +2 -2
  90. data/test/auth_token.rb +39 -0
  91. data/test/helper.rb +31 -31
  92. data/test/session_helper.rb +20 -0
  93. data/test/test_session.rb +53 -0
  94. metadata +115 -67
  95. data/lib/citygrid/api/ad_center/account.rb +0 -26
  96. data/lib/citygrid/api/ad_center/account_manager.rb +0 -8
  97. data/lib/citygrid/api/ad_center/ad_group.rb +0 -8
  98. data/lib/citygrid/api/ad_center/ad_group_ad.rb +0 -8
  99. data/lib/citygrid/api/ad_center/ad_group_criterion.rb +0 -8
  100. data/lib/citygrid/api/ad_center/ad_group_geo.rb +0 -8
  101. data/lib/citygrid/api/ad_center/authentication.rb +0 -20
  102. data/lib/citygrid/api/ad_center/billing.rb +0 -8
  103. data/lib/citygrid/api/ad_center/budget.rb +0 -9
  104. data/lib/citygrid/api/ad_center/call_detail.rb +0 -25
  105. data/lib/citygrid/api/ad_center/campaign.rb +0 -8
  106. data/lib/citygrid/api/ad_center/category.rb +0 -9
  107. data/lib/citygrid/api/ad_center/geolocation.rb +0 -9
  108. data/lib/citygrid/api/ad_center/method_of_payment.rb +0 -10
  109. data/lib/citygrid/api/ad_center/places.rb +0 -8
  110. data/lib/citygrid/api/ad_center/user.rb +0 -8
  111. data/lib/citygrid/api/ad_center.rb +0 -20
  112. data/lib/citygrid/api/content/places/detail.rb +0 -11
  113. data/lib/citygrid/api/content/places/search.rb +0 -11
  114. data/test/api/ad_center/test_account.rb +0 -120
  115. data/test/api/ad_center/test_ad_group.rb +0 -50
  116. data/test/api/ad_center/test_ad_group_ad.rb +0 -27
  117. data/test/api/ad_center/test_ad_group_criterion.rb +0 -37
  118. data/test/api/ad_center/test_authentication.rb +0 -22
  119. data/test/api/ad_center/test_campaign.rb +0 -27
  120. data/test/api/ad_center/test_method_of_payment.rb +0 -51
  121. data/test/api/ad_center/test_places.rb +0 -79
  122. data/test/api/content/test_places.rb +0 -66
@@ -1,10 +0,0 @@
1
- class CityGrid
2
- class API
3
- class AdCenter
4
- class MethodOfPayment < AdCenter
5
- server :ssl
6
- endpoint "/adcenter/account/v2/mop"
7
- end
8
- end
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- class CityGrid
2
- class API
3
- class AdCenter
4
- class Places < AdCenter
5
- end
6
- end
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- class CityGrid
2
- class API
3
- class AdCenter
4
- class User < AdCenter
5
- end
6
- end
7
- end
8
- end
@@ -1,20 +0,0 @@
1
- class CityGrid
2
- class API
3
- class AdCenter < API
4
- server :default
5
- def self.initialize
6
- puts "init adCenter"
7
- end
8
- end
9
- end
10
- end
11
-
12
- [
13
- "account", "account_manager", "ad_group", "ad_group_ad", "ad_group_criterion", "ad_group_geo",
14
- "authentication", "budget", "campaign", "category", "geolocation", "method_of_payment", "places", "performance",
15
- "image", "user", "call_detail", "billing"
16
- ].each do |x|
17
- require "citygrid/api/ad_center/#{x}"
18
- end
19
-
20
-
@@ -1,11 +0,0 @@
1
- class CityGrid
2
- class API
3
- class Content
4
- class Places
5
- class Detail < Places
6
- endpoint "/content/places/v2/detail"
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- class CityGrid
2
- class API
3
- class Content
4
- class Places
5
- class Search < Places
6
- endpoint "/content/places/v2/search/where"
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,120 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- token = AuthToken.generate
4
- context "Search for a user" do
5
- context "by name" do
6
- setup do
7
- run_with_rescue do
8
- CityGrid::API::AdCenter::Account.search(
9
- :token => AuthToken.sales_coord,
10
- :userName => '25-1'
11
- )
12
- end
13
- end
14
- should("not be empty"){ !topic.empty? }
15
- should("return message OK"){ topic.accountResources.first.response.message }.equals("OK")
16
- should("return response code OK"){ topic.accountResources.first.response.code.to_i }.equals(200)
17
- end
18
-
19
- context "Search by id" do
20
- setup do
21
- run_with_rescue do
22
- CityGrid::API::AdCenter::Account.search(
23
- :token => AuthToken.sales_coord,
24
- :id => 1250702
25
- )
26
- end
27
- end
28
- should("not be empty"){ !topic.empty? }
29
- should("return message OK"){ topic.accountResources.first.response.message }.equals("OK")
30
- should("return response code OK"){ topic.accountResources.first.response.code.to_i }.equals(200)
31
- end
32
- end
33
-
34
-
35
- context "Search for account type" do
36
- context "Search by id" do
37
- setup do
38
- run_with_rescue do
39
- CityGrid::API::AdCenter::Account.account_type(
40
- :token => token,
41
- :id => 1250702
42
- )
43
- end
44
- end
45
- should("not be empty"){ !topic.empty? }
46
- should("return message OK"){ topic.response.message }.equals("OK")
47
- should("return response code OK"){ topic.response.code.to_i }.equals(200)
48
- should("return type s CYB code OK"){ topic.accountType }.equals("CYB")
49
- end
50
- end
51
-
52
- context "Import a cg account" do
53
- setup do
54
- run_with_rescue do
55
- auth_token = CityGrid.login(
56
- :username => 'GARYTEST',
57
- :password => 'pppppp'
58
- ).authToken
59
-
60
- CityGrid::API::AdCenter::Account.import_to_cg(
61
- :token => auth_token,
62
- "mutateOperationListResource" => [{
63
- "operator" => "ADD",
64
- "operand" => {
65
- "firstName" => "nico-api",
66
- "lastName" => "gomez-api",
67
- "phone" => "9001111112",
68
- "businessName" =>"businessProveApi",
69
- "address1" =>"dir-api",
70
- "city" =>"montevideo",
71
- "state" =>"Montevideo",
72
- "zipCode" =>"90069"
73
- }
74
- }]
75
- )
76
- end
77
- end
78
- should("not be empty"){ !topic.empty? }
79
- should("return message OK"){ topic.accountResources.first.response.message }.equals("OK")
80
- should("return response code OK"){ topic.accountResources.first.response.code.to_i }.equals(200)
81
- end
82
-
83
-
84
- context "Creating an account" do
85
- setup do
86
- run_with_rescue do
87
- CityGrid::API::AdCenter::Account.mutate(
88
- :token => token,
89
- "mutateOperationListResource" => [{
90
- "operator" => "ADD",
91
- "operand" => {
92
- "firstName" => "nico-api",
93
- "lastName" => "gomez-api",
94
- "phone" => "9001111112",
95
- "email" => "goodtry#{rand(1000000)}@a.com",
96
- "userName" => "goodtry#{rand(1000000)}",
97
- "password" => "pppppp",
98
- "businessName" => "businessProveApi",
99
- "address1" => "dir-api",
100
- "city" => "montevideo",
101
- "state" => "Montevideo",
102
- "zipCode" => "90069"
103
- }
104
- }]
105
- )
106
- end
107
- end
108
- should("not be empty"){ !topic.empty? }
109
- should("return message OK"){ topic.accountResources.first.response.message }.equals("OK")
110
- should("return response code OK"){ topic.accountResources.first.response.code.to_i }.equals(200)
111
- end
112
-
113
- context "Logging in" do
114
- setup do
115
- run_with_rescue do
116
- CityGrid.login(:username => "goodtry#{AuthToken.rand_number}", :password => 'pppppp')
117
- end
118
- end
119
- should("return an authToken"){ topic.authToken }
120
- end
@@ -1,50 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- token = AuthToken.generate
4
-
5
- context "Mutating Ad Group" do
6
- setup do
7
- run_with_rescue do
8
- CityGrid::API::AdCenter::AdGroup.search(:token => token, :adGroupIds => 30966312)
9
- end
10
- end
11
- should("not be empty"){ !topic.empty? }
12
- should("have campaignId"){ !topic.adGroups.first.campaignId.nil? }
13
- end
14
-
15
- context "Search Ad Group by Campaign Id" do
16
- setup do
17
- run_with_rescue do
18
- CityGrid::API::AdCenter::AdGroup.search(:token => AuthToken.sales_coord, :campaignId => 2434702)
19
- end
20
- end
21
- should("not be empty"){ !topic.empty? }
22
- should("have campaignId"){ !topic.adGroups.first.campaignId.nil? }
23
- end
24
-
25
-
26
- context "Mutating Ad Group" do
27
- setup do
28
- run_with_rescue do
29
- CityGrid::API::AdCenter::AdGroup.mutate(
30
- :token => token,
31
- "mutateOperationListResource" => [{
32
- "operator" => "ADD",
33
- "operand" => {
34
- "placeId" => "10728522",
35
- "campaignId" => "2435332",
36
- "contractTermMonths" =>"12",
37
- "monthlyServiceFee" => "19.95",
38
- "bids" => [{
39
- "actionTargetName" => "map & directions",
40
- "ppe" => "1.80"
41
- }]
42
- }
43
- }]
44
- )
45
- end
46
- end
47
- should("not be empty"){ !topic.empty? }
48
- should("have campaignId"){ !topic.adGroups.first.campaignId.nil? }
49
- end
50
-
@@ -1,27 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- token = AuthToken.generate
4
-
5
- context "Mutating AdGroup Ads" do
6
- setup do
7
- run_with_rescue do
8
- CityGrid::API::AdCenter::AdGroupAd.mutate(
9
- :token => token,
10
- "mutateOperationListResource" => [{
11
- "operator" => "ADD",
12
- "operand" => {
13
- "groupId" => "31919852",
14
- "ad"=>{
15
- "type" =>"PERFORMANCE_AD",
16
- "tagline" => "ad_tagline",
17
- "imageUrl" => "ad_photo.com"
18
- }
19
- }
20
- }]
21
- )
22
- end
23
- end
24
- should("not be empty"){ !topic.empty? }
25
- should("return code OK"){ topic.adResources.first.response.code }.equals(200)
26
- should("return message OK") { topic.adResources.first.response.message }.equals("OK")
27
- end
@@ -1,37 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
- token = AuthToken.generate
3
- context "AdGroupCriterion" do
4
- context "search" do
5
- setup do
6
- run_with_rescue do
7
- CityGrid::API::AdCenter::AdGroupCriterion.search(:token => AuthToken.sales_coord, :adGroupId => 6)
8
- end
9
- end
10
- should("not be empty?"){ !topic.empty? }
11
- should("return code OK"){ topic.adGroupCriterionResources.first.response.code }.equals(200)
12
- should("return message OK") { topic.adGroupCriterionResources.first.response.message }.equals("OK")
13
- end
14
-
15
- context "mutate" do
16
- setup do
17
- run_with_rescue do
18
- CityGrid::API::AdCenter::AdGroupCriterion.mutate(
19
- :token => token,
20
- "mutateOperationListResource" => [{
21
- "operator" => "ADD",
22
- "operand" => {
23
- "adGroupId" => "31919852",
24
- "adGroupAdId" => "87768542",
25
- "adGroupCriterionId" =>
26
- "1722",
27
- "type" => "2"
28
- }
29
- }]
30
- )
31
- end
32
- end
33
- should("not be empty"){ !topic.empty? }
34
- should("return code OK"){ topic.adGroupCriterionResources.first.response.code }.equals(200)
35
- should("return message OK") { topic.adGroupCriterionResources.first.response.message }.equals("OK")
36
- end
37
- end
@@ -1,22 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- context "Logging in" do
4
- setup do
5
- run_with_rescue do
6
- CityGrid.login(:username => 'GARYTEST', :password => 'pppppp')
7
- end
8
- end
9
- should("return an authToken"){ topic.authToken }
10
- end
11
-
12
- context "Valiate user" do
13
- setup do
14
- run_with_rescue do
15
- token = AuthToken.kunimom
16
- CityGrid::API::AdCenter::Authentication.validate :oauth_token => token
17
- end
18
- end
19
- should("have id"){ topic.id }
20
- should("have status"){ topic.status }
21
- should("have display_name"){ topic.display_name }
22
- end
@@ -1,27 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- token = AuthToken.generate
4
-
5
- context "Adding a campaign" do
6
- setup do
7
- run_with_rescue do
8
- CityGrid::API::AdCenter::Campaign.mutate(
9
- :token => token,
10
- :mutateOperationListResource => [{
11
- :operator => "ADD",
12
- :operand => {
13
- :name => "PleaseWork6",
14
- :startDate => (Date.today+1).to_s.gsub("-", ""),
15
- :endDate => (Date.today + 10).to_s.gsub("-", ""),
16
- :product => "PERFORMANCE",
17
- :budget => {:amount => 30000},
18
- :mopId => 387552
19
- }
20
- }]
21
- )
22
- end
23
- end
24
- should("not be empty"){ !topic.empty? }
25
- should("return code OK"){ topic.campaignResources.first.response.code }.equals(200)
26
- should("return message OK") { topic.campaignResources.first.response.message }.equals("OK")
27
- end
@@ -1,51 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- token = AuthToken.generate
4
-
5
- context "Method of Payment" do
6
- context "search" do
7
- setup do
8
- run_with_rescue do
9
- CityGrid::API::AdCenter::MethodOfPayment.search(:accountId => 111, :token => token)
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
- CityGrid::API::AdCenter::MethodOfPayment.mutate(
21
- :token => token,
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
- )
45
- end
46
- end
47
- should("not be empty"){ !topic.empty? }
48
- should("return code OK"){ topic.resources.first.response.code }.equals(200)
49
- should("return message OK") { topic.resources.first.response.message }.equals("OK")
50
- end
51
- end
@@ -1,79 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- token = AuthToken.generate
4
-
5
- context "Adding a place" do
6
- setup do
7
- run_with_rescue do
8
- CityGrid::API::AdCenter::Places.search(
9
- :token => token,
10
- "placeId" => 11489139
11
- )
12
- end
13
- end
14
-
15
- should("not be empty") { !topic.empty? }
16
- should("return code OK") { topic.response.code }.equals(200)
17
- should("return message OK") { topic.response.message }.equals("OK")
18
- end
19
-
20
- context "Adding a place by Adcenter API" do
21
- setup do
22
- run_with_rescue do
23
- CityGrid::API::AdCenter::Places.mutate(
24
- :token => token,
25
- "mutateOperationListResource" => [{
26
- "operator" => "ADD",
27
- "operand" => {
28
- "name" => "Pi on sunset in LAAAAAAAAAAAAAA",
29
- "address_1" => "Jackson 2102",
30
- "address_2" => "",
31
- "city" => "Los Angeles",
32
- "state" => "California",
33
- "postal_code" => 90025,
34
- "phone_number" => 3103333333,
35
- "website_url" => "pi.com",
36
- "primary_tag_id" => "3623",
37
- "bullet1" => "Knoll bullet 1",
38
- "tagline" => "my tagline",
39
- "primary_tag_id" => 3623,
40
- "secondary_tags" => '1776'}
41
- }]
42
- )
43
- end
44
- end
45
- should("not be empty") { !topic.empty? }
46
- should("return code OK") { topic.resources.first.response.code }.equals(200)
47
- should("return message OK") { topic.resources.first.response.message.upcase }.equals("OK")
48
- end
49
-
50
- context "Update a place by Adcenter API" do
51
- setup do
52
- run_with_rescue do
53
- CityGrid::API::AdCenter::Places.mutate(
54
- :token => token,
55
- "mutateOperationListResource" => [{
56
- "operator" => "SET",
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
- "listing_id" => 755498442}
72
- }]
73
- )
74
- end
75
- end
76
- should("not be empty"){ !topic.empty? }
77
- should("return code OK"){ topic.resources.first.response.code }.equals(200)
78
- should("return message OK") { topic.resources.first.response.message }.equals("OK")
79
- end
@@ -1,66 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
2
-
3
- token = AuthToken.generate
4
-
5
- context "Adding a place" do
6
- setup do
7
- run_with_rescue do
8
- CityGrid::API::Content::Places.mutate(
9
- :token => token,
10
- "mutateOperationListResource" => [{
11
- "operator" => "ADD",
12
- "operand" => {
13
- # "accountId" => "123",
14
- "name" => "Pi on sunset in LAAAAAAAAAAAAAA",
15
- "address_1" => "Jackson 2102",
16
- "address_2" => "",
17
- "city" => "Los Angeles",
18
- "state" => "California",
19
- "postal_code" => 90025,
20
- "phone_number" => 3103333333,
21
- "website_url" => "pi.com",
22
- "primary_tag_id" => "3623",
23
- "bullet1" => "Knoll bullet 1",
24
- "tagline" => "my tagline",
25
- "primary_tag_id" => 3623,
26
- "secondary_tags" => '1776'}
27
- }]
28
- )
29
- end
30
- end
31
- should("not be empty") { !topic.empty? }
32
- should("return code OK") { topic.resources.first.response.code }.equals(200)
33
- should("return message OK") { topic.resources.first.response.message.upcase }.equals("OK")
34
- end
35
-
36
- context "Update a place" do
37
- setup do
38
- run_with_rescue do
39
- CityGrid::API::Content::Places.mutate(
40
- :token => token,
41
- "mutateOperationListResource" => [{
42
- "operator" => "SET",
43
- "operand" => {
44
- # "accountId" => "123",
45
- "name" => "Pi on sunset in LAAAAAAAAAAAAAA",
46
- "address_1" => "Jackson 2102",
47
- "address_2" => "",
48
- "city" => "Los Angeles",
49
- "state" => "California",
50
- "postal_code" => 90025,
51
- "phone_number" => 3103333333,
52
- "website_url" => "pi.com",
53
- "primary_tag_id" => "3623",
54
- "bullet1" => "Knoll bullet 1",
55
- "tagline" => "my tagline",
56
- "primary_tag_id" => 3623,
57
- "secondary_tags" => '1776',
58
- "listing_id" => 755498442}
59
- }]
60
- )
61
- end
62
- end
63
- should("not be empty"){ !topic.empty? }
64
- should("return code OK"){ topic.resources.first.response.code }.equals(200)
65
- should("return message OK") { topic.resources.first.response.message }.equals("OK")
66
- end