oi-api-ruby 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +7 -0
  2. data/.env.sample +2 -0
  3. data/.gitignore +3 -0
  4. data/.rspec +4 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +35 -0
  9. data/Rakefile +9 -0
  10. data/api_issues.md +89 -0
  11. data/lib/oi_api.rb +12 -0
  12. data/lib/oi_api/client.rb +98 -0
  13. data/lib/oi_api/client/advertisers.rb +31 -0
  14. data/lib/oi_api/client/auto_responders.rb +35 -0
  15. data/lib/oi_api/client/balances.rb +15 -0
  16. data/lib/oi_api/client/cards.rb +33 -0
  17. data/lib/oi_api/client/charges.rb +15 -0
  18. data/lib/oi_api/client/data_transfers.rb +31 -0
  19. data/lib/oi_api/client/offers.rb +32 -0
  20. data/lib/oi_api/client/reports.rb +15 -0
  21. data/lib/oi_api/client/subscriptions.rb +23 -0
  22. data/lib/oi_api/configuration.rb +50 -0
  23. data/lib/oi_api/lookup_tables.rb +42 -0
  24. data/lib/oi_api/version.rb +3 -0
  25. data/oi-api-ruby.gemspec +31 -0
  26. data/spec/cassettes/OiApi_Client_Advertisers/_advertiser/it_should_behave_like_GET_resource/returns_200_OK.yml +157 -0
  27. data/spec/cassettes/OiApi_Client_Advertisers/_advertiser/it_should_behave_like_GET_resource/returns_HTTParty_Response.yml +157 -0
  28. data/spec/cassettes/OiApi_Client_Advertisers/_advertiser/it_should_behave_like_GET_resource/returns_the_resource.yml +157 -0
  29. data/spec/cassettes/OiApi_Client_Advertisers/_advertiser/it_should_behave_like_GET_resource/when_advertiser_id_not_found/returns_404.yml +77 -0
  30. data/spec/cassettes/OiApi_Client_Advertisers/_advertiser/it_should_behave_like_GET_resource/when_advertiser_id_not_found/returns_not_found_error_message.yml +117 -0
  31. data/spec/cassettes/OiApi_Client_Advertisers/_advertisers/it_should_behave_like_GET_resources/returns_200_OK.yml +157 -0
  32. data/spec/cassettes/OiApi_Client_Advertisers/_advertisers/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +237 -0
  33. data/spec/cassettes/OiApi_Client_Advertisers/_advertisers/it_should_behave_like_GET_resources/returns_all_resources.yml +237 -0
  34. data/spec/cassettes/OiApi_Client_Advertisers/_create_advertiser/it_should_behave_like_POST_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +117 -0
  35. data/spec/cassettes/OiApi_Client_Advertisers/_create_advertiser/it_should_behave_like_POST_resource/bad_request/returns_an_error_message.yml +77 -0
  36. data/spec/cassettes/OiApi_Client_Advertisers/_create_advertiser/it_should_behave_like_POST_resource/bad_request/returns_an_error_status.yml +77 -0
  37. data/spec/cassettes/OiApi_Client_Advertisers/_create_advertiser/it_should_behave_like_POST_resource/returns_201_created.yml +118 -0
  38. data/spec/cassettes/OiApi_Client_Advertisers/_create_advertiser/it_should_behave_like_POST_resource/returns_a_success_message.yml +78 -0
  39. data/spec/cassettes/OiApi_Client_Advertisers/_create_advertiser/it_should_behave_like_POST_resource/returns_a_success_status.yml +118 -0
  40. data/spec/cassettes/OiApi_Client_Advertisers/_delete_advertiser/it_should_behave_like_DELETE_resource/deletes_a_data_transfer.yml +153 -0
  41. data/spec/cassettes/OiApi_Client_Advertisers/_delete_advertiser/it_should_behave_like_DELETE_resource/returns_200_OK.yml +116 -0
  42. data/spec/cassettes/OiApi_Client_Advertisers/_delete_advertiser/it_should_behave_like_DELETE_resource/returns_the_correct_message.yml +196 -0
  43. data/spec/cassettes/OiApi_Client_Advertisers/_delete_advertiser/it_should_behave_like_DELETE_resource/returns_the_correct_status.yml +116 -0
  44. data/spec/cassettes/OiApi_Client_Advertisers/_delete_advertiser/it_should_behave_like_DELETE_resource/when_advertiser_not_found/returns_404.yml +77 -0
  45. data/spec/cassettes/OiApi_Client_Advertisers/_delete_advertiser/it_should_behave_like_DELETE_resource/when_advertiser_not_found/returns_not_found_error_message.yml +77 -0
  46. data/spec/cassettes/OiApi_Client_Advertisers/_delete_advertiser/it_should_behave_like_DELETE_resource/when_advertiser_not_found/returns_not_found_error_status.yml +77 -0
  47. data/spec/cassettes/OiApi_Client_Advertisers/_reports/it_should_behave_like_GET_resources/returns_200_OK.yml +42 -0
  48. data/spec/cassettes/OiApi_Client_Advertisers/_reports/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +42 -0
  49. data/spec/cassettes/OiApi_Client_Advertisers/_reports/it_should_behave_like_GET_resources/returns_all_resources.yml +42 -0
  50. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +116 -0
  51. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/bad_request/returns_an_error_message.yml +156 -0
  52. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/bad_request/returns_an_error_status.yml +156 -0
  53. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/returns_200_OK.yml +155 -0
  54. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/returns_the_correct_message.yml +155 -0
  55. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/returns_the_correct_status.yml +195 -0
  56. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/when_advertiser_not_found/returns_404.yml +117 -0
  57. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/when_advertiser_not_found/returns_error_status.yml +77 -0
  58. data/spec/cassettes/OiApi_Client_Advertisers/_update_advertiser/it_should_behave_like_PUT_resource/when_advertiser_not_found/returns_not_found_error_message.yml +77 -0
  59. data/spec/cassettes/OiApi_Client_AutoResponders/_all_auto_responders/it_should_behave_like_GET_resources/returns_200_OK.yml +593 -0
  60. data/spec/cassettes/OiApi_Client_AutoResponders/_all_auto_responders/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +593 -0
  61. data/spec/cassettes/OiApi_Client_AutoResponders/_all_auto_responders/it_should_behave_like_GET_resources/returns_all_resources.yml +593 -0
  62. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders/it_should_behave_like_GET_resources/returns_200_OK.yml +273 -0
  63. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +273 -0
  64. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders/it_should_behave_like_GET_resources/returns_all_resources.yml +273 -0
  65. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders_no_offer_id/it_should_behave_like_GET_resources/returns_200_OK.yml +593 -0
  66. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders_no_offer_id/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +673 -0
  67. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders_no_offer_id/it_should_behave_like_GET_resources/returns_all_resources.yml +516 -0
  68. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders_with_offer_id/it_should_behave_like_GET_resources/returns_200_OK.yml +273 -0
  69. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders_with_offer_id/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +354 -0
  70. data/spec/cassettes/OiApi_Client_AutoResponders/_auto_responders_with_offer_id/it_should_behave_like_GET_resources/returns_all_resources.yml +354 -0
  71. data/spec/cassettes/OiApi_Client_Balances/_balance/it_should_behave_like_GET_resources/returns_200_OK.yml +78 -0
  72. data/spec/cassettes/OiApi_Client_Balances/_balance/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +78 -0
  73. data/spec/cassettes/OiApi_Client_Balances/_balance/it_should_behave_like_GET_resources/returns_all_resources.yml +78 -0
  74. data/spec/cassettes/OiApi_Client_Balances/_balance/returns_a_balance.yml +78 -0
  75. data/spec/cassettes/OiApi_Client_Cards/_card/it_should_behave_like_GET_resource/returns_200_OK.yml +117 -0
  76. data/spec/cassettes/OiApi_Client_Cards/_card/it_should_behave_like_GET_resource/returns_HTTParty_Response.yml +117 -0
  77. data/spec/cassettes/OiApi_Client_Cards/_card/it_should_behave_like_GET_resource/returns_the_resource.yml +117 -0
  78. data/spec/cassettes/OiApi_Client_Cards/_card/it_should_behave_like_GET_resource/when_card_id_not_found/returns_404.yml +79 -0
  79. data/spec/cassettes/OiApi_Client_Cards/_card/it_should_behave_like_GET_resource/when_card_id_not_found/returns_not_found_error_message.yml +79 -0
  80. data/spec/cassettes/OiApi_Client_Cards/_create_card/it_should_behave_like_POST_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +80 -0
  81. data/spec/cassettes/OiApi_Client_Cards/_create_card/it_should_behave_like_POST_resource/bad_request/returns_an_error_message.yml +80 -0
  82. data/spec/cassettes/OiApi_Client_Cards/_create_card/it_should_behave_like_POST_resource/bad_request/returns_an_error_status.yml +80 -0
  83. data/spec/cassettes/OiApi_Client_Cards/_create_card/it_should_behave_like_POST_resource/returns_201_created.yml +80 -0
  84. data/spec/cassettes/OiApi_Client_Cards/_create_card/it_should_behave_like_POST_resource/returns_a_success_message.yml +80 -0
  85. data/spec/cassettes/OiApi_Client_Cards/_create_card/it_should_behave_like_POST_resource/returns_a_success_status.yml +80 -0
  86. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +117 -0
  87. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/bad_request/returns_an_error_message.yml +117 -0
  88. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/bad_request/returns_an_error_status.yml +117 -0
  89. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/returns_200_OK.yml +117 -0
  90. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/returns_the_correct_message.yml +117 -0
  91. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/returns_the_correct_status.yml +117 -0
  92. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/when_card_not_found/returns_404.yml +79 -0
  93. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/when_card_not_found/returns_error_status.yml +79 -0
  94. data/spec/cassettes/OiApi_Client_Cards/_update_card/it_should_behave_like_PUT_resource/when_card_not_found/returns_not_found_error_message.yml +79 -0
  95. data/spec/cassettes/OiApi_Client_DataTransfers/_create_data_transfer/it_should_behave_like_POST_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +352 -0
  96. data/spec/cassettes/OiApi_Client_DataTransfers/_create_data_transfer/it_should_behave_like_POST_resource/bad_request/returns_an_error_message.yml +352 -0
  97. data/spec/cassettes/OiApi_Client_DataTransfers/_create_data_transfer/it_should_behave_like_POST_resource/bad_request/returns_an_error_status.yml +352 -0
  98. data/spec/cassettes/OiApi_Client_DataTransfers/_create_data_transfer/it_should_behave_like_POST_resource/returns_201_created.yml +352 -0
  99. data/spec/cassettes/OiApi_Client_DataTransfers/_create_data_transfer/it_should_behave_like_POST_resource/returns_a_success_message.yml +272 -0
  100. data/spec/cassettes/OiApi_Client_DataTransfers/_create_data_transfer/it_should_behave_like_POST_resource/returns_a_success_status.yml +352 -0
  101. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfer/it_should_behave_like_GET_resource/returns_200_OK.yml +393 -0
  102. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfer/it_should_behave_like_GET_resource/returns_HTTParty_Response.yml +393 -0
  103. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfer/it_should_behave_like_GET_resource/returns_the_resource.yml +472 -0
  104. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfer/it_should_behave_like_GET_resource/when_data_transfer_id_not_found/returns_404.yml +115 -0
  105. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfer/it_should_behave_like_GET_resource/when_data_transfer_id_not_found/returns_not_found_error_message.yml +236 -0
  106. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfers/it_should_behave_like_GET_resources/returns_200_OK.yml +354 -0
  107. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfers/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +434 -0
  108. data/spec/cassettes/OiApi_Client_DataTransfers/_data_transfers/it_should_behave_like_GET_resources/returns_all_resources.yml +434 -0
  109. data/spec/cassettes/OiApi_Client_DataTransfers/_delete_data_transfer/it_should_behave_like_DELETE_resource/deletes_a_data_transfer.yml +428 -0
  110. data/spec/cassettes/OiApi_Client_DataTransfers/_delete_data_transfer/it_should_behave_like_DELETE_resource/returns_200_OK.yml +390 -0
  111. data/spec/cassettes/OiApi_Client_DataTransfers/_delete_data_transfer/it_should_behave_like_DELETE_resource/returns_the_correct_message.yml +310 -0
  112. data/spec/cassettes/OiApi_Client_DataTransfers/_delete_data_transfer/it_should_behave_like_DELETE_resource/returns_the_correct_status.yml +390 -0
  113. data/spec/cassettes/OiApi_Client_DataTransfers/_delete_data_transfer/it_should_behave_like_DELETE_resource/when_data_transfer_not_found/returns_404.yml +115 -0
  114. data/spec/cassettes/OiApi_Client_DataTransfers/_delete_data_transfer/it_should_behave_like_DELETE_resource/when_data_transfer_not_found/returns_not_found_error_message.yml +195 -0
  115. data/spec/cassettes/OiApi_Client_DataTransfers/_delete_data_transfer/it_should_behave_like_DELETE_resource/when_data_transfer_not_found/returns_not_found_error_status.yml +115 -0
  116. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +390 -0
  117. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/bad_request/returns_an_error_message.yml +390 -0
  118. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/bad_request/returns_an_error_status.yml +390 -0
  119. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/returns_200_OK.yml +389 -0
  120. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/returns_the_correct_message.yml +389 -0
  121. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/returns_the_correct_status.yml +349 -0
  122. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/when_data_transfer_not_found/returns_404.yml +274 -0
  123. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/when_data_transfer_not_found/returns_error_status.yml +234 -0
  124. data/spec/cassettes/OiApi_Client_DataTransfers/_update_data_transfer/it_should_behave_like_PUT_resource/when_data_transfer_not_found/returns_not_found_error_message.yml +234 -0
  125. data/spec/cassettes/OiApi_Client_Offers/_create_offer/it_should_behave_like_POST_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +195 -0
  126. data/spec/cassettes/OiApi_Client_Offers/_create_offer/it_should_behave_like_POST_resource/bad_request/returns_an_error_message.yml +195 -0
  127. data/spec/cassettes/OiApi_Client_Offers/_create_offer/it_should_behave_like_POST_resource/bad_request/returns_an_error_status.yml +195 -0
  128. data/spec/cassettes/OiApi_Client_Offers/_create_offer/it_should_behave_like_POST_resource/returns_201_created.yml +196 -0
  129. data/spec/cassettes/OiApi_Client_Offers/_create_offer/it_should_behave_like_POST_resource/returns_a_success_message.yml +156 -0
  130. data/spec/cassettes/OiApi_Client_Offers/_create_offer/it_should_behave_like_POST_resource/returns_a_success_status.yml +196 -0
  131. data/spec/cassettes/OiApi_Client_Offers/_offer/it_should_behave_like_GET_resource/returns_200_OK.yml +246 -0
  132. data/spec/cassettes/OiApi_Client_Offers/_offer/it_should_behave_like_GET_resource/returns_HTTParty_Response.yml +246 -0
  133. data/spec/cassettes/OiApi_Client_Offers/_offer/it_should_behave_like_GET_resource/returns_the_resource.yml +284 -0
  134. data/spec/cassettes/OiApi_Client_Offers/_offer/it_should_behave_like_GET_resource/when_offer_id_not_found/returns_404.yml +115 -0
  135. data/spec/cassettes/OiApi_Client_Offers/_offer/it_should_behave_like_GET_resource/when_offer_id_not_found/returns_not_found_error_message.yml +195 -0
  136. data/spec/cassettes/OiApi_Client_Offers/_offers/it_should_behave_like_GET_resources/returns_200_OK.yml +416 -0
  137. data/spec/cassettes/OiApi_Client_Offers/_offers/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +457 -0
  138. data/spec/cassettes/OiApi_Client_Offers/_offers/it_should_behave_like_GET_resources/returns_all_resources.yml +457 -0
  139. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/bad_request/returns_400_bad_request_with_invalid_params.yml +194 -0
  140. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/bad_request/returns_an_error_message.yml +234 -0
  141. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/bad_request/returns_an_error_status.yml +234 -0
  142. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/returns_200_OK.yml +234 -0
  143. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/returns_the_correct_message.yml +234 -0
  144. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/returns_the_correct_status.yml +315 -0
  145. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/when_offer_not_found/returns_404.yml +154 -0
  146. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/when_offer_not_found/returns_error_status.yml +114 -0
  147. data/spec/cassettes/OiApi_Client_Offers/_update_offer/it_should_behave_like_PUT_resource/when_offer_not_found/returns_not_found_error_message.yml +114 -0
  148. data/spec/cassettes/OiApi_Client_Reports/_reports/it_should_behave_like_GET_resources/returns_200_OK.yml +46 -0
  149. data/spec/cassettes/OiApi_Client_Reports/_reports/it_should_behave_like_GET_resources/returns_HTTParty_Response.yml +46 -0
  150. data/spec/cassettes/OiApi_Client_Reports/_reports/it_should_behave_like_GET_resources/returns_all_resources.yml +46 -0
  151. data/spec/cassettes/OiApi_Client_Reports/_reports/returns_a_report_summary.yml +46 -0
  152. data/spec/cassettes/OiApi_Client_Reports/_reports_with_query_params/retrieves_the_last_60_days_of_data.yml +42 -0
  153. data/spec/oi_api/client/advertisers_spec.rb +86 -0
  154. data/spec/oi_api/client/auto_responders_spec.rb +55 -0
  155. data/spec/oi_api/client/balances_spec.rb +22 -0
  156. data/spec/oi_api/client/cards_spec.rb +60 -0
  157. data/spec/oi_api/client/charges_spec.rb +9 -0
  158. data/spec/oi_api/client/data_transfers_spec.rb +95 -0
  159. data/spec/oi_api/client/offers_spec.rb +84 -0
  160. data/spec/oi_api/client/reports_spec.rb +31 -0
  161. data/spec/oi_api/client/subscriptions_spec.rb +11 -0
  162. data/spec/oi_api_spec.rb +49 -0
  163. data/spec/shared_examples_for_delete_resource.rb +37 -0
  164. data/spec/shared_examples_for_get_resource.rb +33 -0
  165. data/spec/shared_examples_for_get_resources.rb +15 -0
  166. data/spec/shared_examples_for_post_resource.rb +31 -0
  167. data/spec/shared_examples_for_put_resource.rb +46 -0
  168. data/spec/spec_helper.rb +60 -0
  169. data/spec/support/advertisers_factory.rb +22 -0
  170. data/spec/support/auto_responders_factory.rb +27 -0
  171. data/spec/support/balances_factory.rb +12 -0
  172. data/spec/support/cards_factory.rb +34 -0
  173. data/spec/support/charges_factory.rb +16 -0
  174. data/spec/support/data_transfers_factory.rb +34 -0
  175. data/spec/support/factory.rb +48 -0
  176. data/spec/support/offers_factory.rb +53 -0
  177. data/spec/support/reports_factory.rb +12 -0
  178. data/spec/support/subscriptions_factory.rb +16 -0
  179. data/spec_output.txt +341 -0
  180. metadata +487 -0
@@ -0,0 +1,31 @@
1
+ module OiApi
2
+
3
+ class Client
4
+
5
+ module DataTransfers
6
+
7
+ def data_transfers(options = {})
8
+ get("/datatransfers/", options)
9
+ end
10
+
11
+ def data_transfer(data_transfer_id, options = {})
12
+ get("/datatransfers/#{data_transfer_id}/", options)
13
+ end
14
+
15
+ def create_data_transfer(offer_id, options = {})
16
+ post("/offers/#{offer_id}/datatransfers/", options)
17
+ end
18
+
19
+ def update_data_transfer(offer_id, data_transfer_id, options = {})
20
+ put("/offers/#{offer_id}/datatransfers/#{data_transfer_id}/", options)
21
+ end
22
+
23
+ def delete_data_transfer(data_transfer_id, options = {})
24
+ delete("/datatransfers/#{data_transfer_id}/", options)
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,32 @@
1
+ module OiApi
2
+
3
+ class Client
4
+
5
+ module Offers
6
+
7
+ def offers(options = {})
8
+ self.class.get("/offers/", options_with_basic_auth(options))
9
+ end
10
+
11
+ def offer(offer_id, options = {})
12
+ self.class.get("/offers/#{offer_id}/", options_with_basic_auth(options))
13
+ end
14
+
15
+ def create_offer(options = {})
16
+ self.class.post('/offers/', options_with_basic_auth(options))
17
+ end
18
+
19
+ def update_offer(offer_id, options = {})
20
+ self.class.put("/offers/#{offer_id}/", options_with_basic_auth(options))
21
+ end
22
+
23
+ # DELETE not allowed for offers?
24
+ #def delete_offer(offer_id, options = {})
25
+ # self.class.delete("/offers/#{offer_id}/", options_with_basic_auth(options))
26
+ #end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
@@ -0,0 +1,15 @@
1
+ module OiApi
2
+
3
+ class Client
4
+
5
+ module Reports
6
+
7
+ def reports(options = {})
8
+ get '/reports/advertisers/', options
9
+ end
10
+
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,23 @@
1
+ module OiApi
2
+
3
+ class Client
4
+
5
+ module Subscriptions
6
+
7
+ def subscriptions(advertiser_id, options = {})
8
+ post "/advertisers/#{advertiser_id}/subscriptions/", options
9
+ end
10
+
11
+ def subscription(advertiser_id, subscription_id, options = {})
12
+ get "/advertisers/#{advertiser_id}/subscriptions/#{subscription_id}", options
13
+ end
14
+
15
+ def create_subscription(advertiser_id, options = {})
16
+ post "/advertisers/#{advertiser_id}/subscriptions/", options
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,50 @@
1
+ require 'oi_api/version'
2
+ require 'pry'
3
+
4
+ module OiApi
5
+
6
+ module Configuration
7
+
8
+ VALID_CONFIG_KEYS = [
9
+ :username,
10
+ :password,
11
+ :api_endpoint,
12
+ :user_agent,
13
+ :format,
14
+ :content_type,
15
+ :debug_output
16
+ ]
17
+
18
+ DEFAULT_API_ENDPOINT = 'https://oiapi.com/v1/'.freeze
19
+ DEFAULT_USER_AGENT = "OiApiRuby Gem #{OiApi::VERSION}".freeze
20
+ DEFAULT_FORMAT = :json
21
+ DEFAULT_CONTENT_TYPE = 'application/json'
22
+ DEFAULT_DEBUG_OUTPUT = false # $stdout
23
+
24
+ attr_accessor *VALID_CONFIG_KEYS
25
+
26
+ def configure
27
+ yield self
28
+ end
29
+
30
+ def self.extended(base)
31
+ base.reset
32
+ end
33
+
34
+ def options
35
+ Hash[ *VALID_CONFIG_KEYS.map { |key| [key, public_send(key)] }.flatten ]
36
+ end
37
+
38
+ def reset
39
+ self.username = nil
40
+ self.password = nil
41
+ self.api_endpoint = DEFAULT_API_ENDPOINT
42
+ self.user_agent = DEFAULT_USER_AGENT
43
+ self.format = DEFAULT_FORMAT
44
+ self.content_type = DEFAULT_CONTENT_TYPE
45
+ self.debug_output = DEFAULT_DEBUG_OUTPUT
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,42 @@
1
+ module OiApi
2
+
3
+ module LookupTables
4
+
5
+ CATEGORIES = {
6
+ 'Beauty & Fashion' => 1000,
7
+ 'Business' => 1001,
8
+ 'Entertainment' => 1002,
9
+ 'Food & Dining' => 1003,
10
+ 'Health & Fitness' => 1004,
11
+ 'Home & Family' => 1005,
12
+ 'Investing' => 1006,
13
+ 'Market Research' => 1007,
14
+ 'News & Education' => 1008,
15
+ 'Personal Finance' => 1009,
16
+ 'Retail & E-commerce' => 1010,
17
+ 'Social' => 1011,
18
+ 'Travel' => 1012,
19
+ }
20
+
21
+ DATA_POINTS = {
22
+ FN: { dynamic_field_value: '#{FN}', description: 'First Name' },
23
+ LN: { dynamic_field_value: '#{LN}', description: 'Last Name' },
24
+ EM: { dynamic_field_value: '#{EM}', description: 'Email' },
25
+ AD1: { dynamic_field_value: '#{AD1}', description: 'Street Address' },
26
+ CI: { dynamic_field_value: '#{CI}', description: 'City' },
27
+ ST: { dynamic_field_value: '#{ST}', description: 'State' },
28
+ PO: { dynamic_field_value: '#{PO}', description: 'Postal Code' },
29
+ CO: { dynamic_field_value: '#{CO}', description: 'Country' },
30
+ HP: { dynamic_field_value: '#{HP}', description: 'Home Phone Number' },
31
+ MP: { dynamic_field_value: '#{MP}', description: 'Mobile Phone Number' },
32
+ G: { dynamic_field_value: '#{G}', description: 'Gender' },
33
+ DOB: { dynamic_filed_value: '#{DOB}', description: 'Date of Birth' }
34
+ }
35
+
36
+ def category_names
37
+ CATEGORIES.keys
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,3 @@
1
+ module OiApi
2
+ VERSION = '0.1.1'
3
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'oi_api/version'
5
+ require 'yaml'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'oi-api-ruby'
9
+ spec.version = OiApi::VERSION
10
+ spec.authors = ['Jarrod Spillers']
11
+ spec.email = ['jarrod@stacktact.com']
12
+ spec.description = %q{Ruby client for Opt Intelligence API, http://www.opt-intelligence.com/}
13
+ spec.summary = spec.description
14
+ spec.homepage = 'https://github.com/wmabee/oi-api-ruby'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'rake', '~> 10.4.2'
24
+ spec.add_development_dependency 'rspec', '~> 3.0'
25
+ spec.add_development_dependency 'pry', '~> 0.10.1'
26
+ spec.add_development_dependency 'vcr', '~> 2.9.3'
27
+ spec.add_development_dependency 'dotenv', '~> 2.0.1'
28
+ spec.add_development_dependency 'webmock', '~> 1.21.0'
29
+
30
+ spec.add_dependency 'httparty', '~> 0.13.3'
31
+ end
@@ -0,0 +1,157 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - OiApiRuby Gem 0.1.1
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Fri, 24 Apr 2015 22:34:39 GMT
21
+ Server:
22
+ - Apache/2.2.15 (CentOS)
23
+ Vary:
24
+ - Accept,Cookie
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ Allow:
28
+ - GET, POST, HEAD, OPTIONS
29
+ Connection:
30
+ - close
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Content-Type:
34
+ - application/json
35
+ body:
36
+ encoding: UTF-8
37
+ string: '[{"id": 40334, "name": "new advertiser 1c86b9a567ea8a06040c2bd570c5007b",
38
+ "status_id": 1, "category_id": 1010, "key": "", "create_date": "2015-04-24T18:35:40",
39
+ "modify_date": "2015-04-24T18:35:40"}]'
40
+ http_version:
41
+ recorded_at: Fri, 24 Apr 2015 22:35:41 GMT
42
+ - request:
43
+ method: delete
44
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/40334/
45
+ body:
46
+ encoding: US-ASCII
47
+ string: ''
48
+ headers:
49
+ Content-Type:
50
+ - application/json
51
+ User-Agent:
52
+ - OiApiRuby Gem 0.1.1
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ Date:
59
+ - Fri, 24 Apr 2015 22:34:39 GMT
60
+ Server:
61
+ - Apache/2.2.15 (CentOS)
62
+ Vary:
63
+ - Accept,Cookie
64
+ X-Frame-Options:
65
+ - SAMEORIGIN
66
+ Allow:
67
+ - GET, PUT, DELETE, HEAD, OPTIONS
68
+ Connection:
69
+ - close
70
+ Transfer-Encoding:
71
+ - chunked
72
+ Content-Type:
73
+ - application/json
74
+ body:
75
+ encoding: UTF-8
76
+ string: '{"status": "Delete Successful", "message": "Advertiser Succesfully
77
+ deleted"}'
78
+ http_version:
79
+ recorded_at: Fri, 24 Apr 2015 22:35:41 GMT
80
+ - request:
81
+ method: post
82
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/
83
+ body:
84
+ encoding: UTF-8
85
+ string: '{"name":"new advertiser c9badd7fc95376b2614fdbfbe77d19f9","status_id":1,"category_id":1010}'
86
+ headers:
87
+ Content-Type:
88
+ - application/json
89
+ User-Agent:
90
+ - OiApiRuby Gem 0.1.1
91
+ response:
92
+ status:
93
+ code: 201
94
+ message: CREATED
95
+ headers:
96
+ Date:
97
+ - Fri, 24 Apr 2015 22:34:39 GMT
98
+ Server:
99
+ - Apache/2.2.15 (CentOS)
100
+ Vary:
101
+ - Accept,Cookie
102
+ X-Frame-Options:
103
+ - SAMEORIGIN
104
+ Allow:
105
+ - GET, POST, HEAD, OPTIONS
106
+ Connection:
107
+ - close
108
+ Transfer-Encoding:
109
+ - chunked
110
+ Content-Type:
111
+ - application/json
112
+ body:
113
+ encoding: UTF-8
114
+ string: '{"status": "Create Successful", "message": "Advertiser successfully
115
+ created", "id": 40335}'
116
+ http_version:
117
+ recorded_at: Fri, 24 Apr 2015 22:35:42 GMT
118
+ - request:
119
+ method: get
120
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/40335/
121
+ body:
122
+ encoding: US-ASCII
123
+ string: ''
124
+ headers:
125
+ Content-Type:
126
+ - application/json
127
+ User-Agent:
128
+ - OiApiRuby Gem 0.1.1
129
+ response:
130
+ status:
131
+ code: 200
132
+ message: OK
133
+ headers:
134
+ Date:
135
+ - Fri, 24 Apr 2015 22:34:40 GMT
136
+ Server:
137
+ - Apache/2.2.15 (CentOS)
138
+ Vary:
139
+ - Accept,Cookie
140
+ X-Frame-Options:
141
+ - SAMEORIGIN
142
+ Allow:
143
+ - GET, PUT, DELETE, HEAD, OPTIONS
144
+ Connection:
145
+ - close
146
+ Transfer-Encoding:
147
+ - chunked
148
+ Content-Type:
149
+ - application/json
150
+ body:
151
+ encoding: UTF-8
152
+ string: '{"id": 40335, "name": "new advertiser c9badd7fc95376b2614fdbfbe77d19f9",
153
+ "status_id": 1, "category_id": 1010, "key": "", "create_date": "2015-04-24T18:35:41",
154
+ "modify_date": "2015-04-24T18:35:41"}'
155
+ http_version:
156
+ recorded_at: Fri, 24 Apr 2015 22:35:42 GMT
157
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,157 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - OiApiRuby Gem 0.1.1
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Fri, 24 Apr 2015 22:34:40 GMT
21
+ Server:
22
+ - Apache/2.2.15 (CentOS)
23
+ Vary:
24
+ - Accept,Cookie
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ Allow:
28
+ - GET, POST, HEAD, OPTIONS
29
+ Connection:
30
+ - close
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Content-Type:
34
+ - application/json
35
+ body:
36
+ encoding: UTF-8
37
+ string: '[{"id": 40335, "name": "new advertiser c9badd7fc95376b2614fdbfbe77d19f9",
38
+ "status_id": 1, "category_id": 1010, "key": "", "create_date": "2015-04-24T18:35:41",
39
+ "modify_date": "2015-04-24T18:35:41"}]'
40
+ http_version:
41
+ recorded_at: Fri, 24 Apr 2015 22:35:42 GMT
42
+ - request:
43
+ method: delete
44
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/40335/
45
+ body:
46
+ encoding: US-ASCII
47
+ string: ''
48
+ headers:
49
+ Content-Type:
50
+ - application/json
51
+ User-Agent:
52
+ - OiApiRuby Gem 0.1.1
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ Date:
59
+ - Fri, 24 Apr 2015 22:34:40 GMT
60
+ Server:
61
+ - Apache/2.2.15 (CentOS)
62
+ Vary:
63
+ - Accept,Cookie
64
+ X-Frame-Options:
65
+ - SAMEORIGIN
66
+ Allow:
67
+ - GET, PUT, DELETE, HEAD, OPTIONS
68
+ Connection:
69
+ - close
70
+ Transfer-Encoding:
71
+ - chunked
72
+ Content-Type:
73
+ - application/json
74
+ body:
75
+ encoding: UTF-8
76
+ string: '{"status": "Delete Successful", "message": "Advertiser Succesfully
77
+ deleted"}'
78
+ http_version:
79
+ recorded_at: Fri, 24 Apr 2015 22:35:43 GMT
80
+ - request:
81
+ method: post
82
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/
83
+ body:
84
+ encoding: UTF-8
85
+ string: '{"name":"new advertiser d4fcadac6e025ed4348d28dc5ab4f048","status_id":1,"category_id":1010}'
86
+ headers:
87
+ Content-Type:
88
+ - application/json
89
+ User-Agent:
90
+ - OiApiRuby Gem 0.1.1
91
+ response:
92
+ status:
93
+ code: 201
94
+ message: CREATED
95
+ headers:
96
+ Date:
97
+ - Fri, 24 Apr 2015 22:34:41 GMT
98
+ Server:
99
+ - Apache/2.2.15 (CentOS)
100
+ Vary:
101
+ - Accept,Cookie
102
+ X-Frame-Options:
103
+ - SAMEORIGIN
104
+ Allow:
105
+ - GET, POST, HEAD, OPTIONS
106
+ Connection:
107
+ - close
108
+ Transfer-Encoding:
109
+ - chunked
110
+ Content-Type:
111
+ - application/json
112
+ body:
113
+ encoding: UTF-8
114
+ string: '{"status": "Create Successful", "message": "Advertiser successfully
115
+ created", "id": 40336}'
116
+ http_version:
117
+ recorded_at: Fri, 24 Apr 2015 22:35:43 GMT
118
+ - request:
119
+ method: get
120
+ uri: https://<USERNAME>:<PASSWORD>@oiapi.com/v1/advertisers/40336/
121
+ body:
122
+ encoding: US-ASCII
123
+ string: ''
124
+ headers:
125
+ Content-Type:
126
+ - application/json
127
+ User-Agent:
128
+ - OiApiRuby Gem 0.1.1
129
+ response:
130
+ status:
131
+ code: 200
132
+ message: OK
133
+ headers:
134
+ Date:
135
+ - Fri, 24 Apr 2015 22:34:41 GMT
136
+ Server:
137
+ - Apache/2.2.15 (CentOS)
138
+ Vary:
139
+ - Accept,Cookie
140
+ X-Frame-Options:
141
+ - SAMEORIGIN
142
+ Allow:
143
+ - GET, PUT, DELETE, HEAD, OPTIONS
144
+ Connection:
145
+ - close
146
+ Transfer-Encoding:
147
+ - chunked
148
+ Content-Type:
149
+ - application/json
150
+ body:
151
+ encoding: UTF-8
152
+ string: '{"id": 40336, "name": "new advertiser d4fcadac6e025ed4348d28dc5ab4f048",
153
+ "status_id": 1, "category_id": 1010, "key": "", "create_date": "2015-04-24T18:35:43",
154
+ "modify_date": "2015-04-24T18:35:43"}'
155
+ http_version:
156
+ recorded_at: Fri, 24 Apr 2015 22:35:43 GMT
157
+ recorded_with: VCR 2.9.3