apiture 0.2.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 (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/Gemfile +8 -0
  4. data/LICENSE +20 -0
  5. data/README.md +38 -0
  6. data/Rakefile +6 -0
  7. data/apiture.gemspec +30 -0
  8. data/lib/apiture.rb +24 -0
  9. data/lib/apiture/api_base.rb +27 -0
  10. data/lib/apiture/api_builder.rb +196 -0
  11. data/lib/apiture/api_error.rb +3 -0
  12. data/lib/apiture/api_group.rb +28 -0
  13. data/lib/apiture/data_model.rb +24 -0
  14. data/lib/apiture/endpoint.rb +25 -0
  15. data/lib/apiture/middleware/auth/api_key.rb +39 -0
  16. data/lib/apiture/middleware/auth/basic.rb +25 -0
  17. data/lib/apiture/middleware/auth/oauth2.rb +31 -0
  18. data/lib/apiture/middleware/convert_json_body.rb +15 -0
  19. data/lib/apiture/middleware/debug.rb +20 -0
  20. data/lib/apiture/middleware/set_body_parameter.rb +20 -0
  21. data/lib/apiture/middleware/set_header.rb +15 -0
  22. data/lib/apiture/middleware/set_parameter_base.rb +37 -0
  23. data/lib/apiture/middleware/set_path_parameter.rb +18 -0
  24. data/lib/apiture/middleware/set_query_parameter.rb +13 -0
  25. data/lib/apiture/middleware_builder.rb +15 -0
  26. data/lib/apiture/middleware_stack.rb +21 -0
  27. data/lib/apiture/request_context.rb +103 -0
  28. data/lib/apiture/swagger/data_type_field.rb +25 -0
  29. data/lib/apiture/swagger/definition.rb +20 -0
  30. data/lib/apiture/swagger/external_docs.rb +10 -0
  31. data/lib/apiture/swagger/info.rb +14 -0
  32. data/lib/apiture/swagger/node.rb +149 -0
  33. data/lib/apiture/swagger/operation.rb +32 -0
  34. data/lib/apiture/swagger/parameter.rb +35 -0
  35. data/lib/apiture/swagger/parser.rb +148 -0
  36. data/lib/apiture/swagger/path.rb +37 -0
  37. data/lib/apiture/swagger/property.rb +15 -0
  38. data/lib/apiture/swagger/security.rb +21 -0
  39. data/lib/apiture/swagger/security_definition.rb +23 -0
  40. data/lib/apiture/swagger/specification.rb +31 -0
  41. data/lib/apiture/uri.rb +36 -0
  42. data/lib/apiture/utils/inflections.rb +46 -0
  43. data/lib/apiture/version.rb +3 -0
  44. data/spec/apiture/api_builder_spec.rb +20 -0
  45. data/spec/apiture/swagger/parser_spec.rb +107 -0
  46. data/spec/apiture/swagger/specification_spec.rb +19 -0
  47. data/spec/apiture_spec.rb +228 -0
  48. data/spec/files/github.json +186 -0
  49. data/spec/files/harvest.json +75 -0
  50. data/spec/files/honeybadger.json +80 -0
  51. data/spec/files/mandrill.json +502 -0
  52. data/spec/files/pivotal_tracker.json +94 -0
  53. data/spec/files/slack.json +88 -0
  54. data/spec/files/uber.json +43 -0
  55. data/spec/fixtures/vcr_cassettes/github_checkAuthorization.yml +70 -0
  56. data/spec/fixtures/vcr_cassettes/github_getUser.yml +82 -0
  57. data/spec/fixtures/vcr_cassettes/harvest_invoiceList.yml +85 -0
  58. data/spec/fixtures/vcr_cassettes/honeybadger.yml +98 -0
  59. data/spec/fixtures/vcr_cassettes/mandrill_messageSend.yml +44 -0
  60. data/spec/fixtures/vcr_cassettes/mandrill_userPing.yml +44 -0
  61. data/spec/fixtures/vcr_cassettes/pivotal_tracker_create_story.yml +61 -0
  62. data/spec/fixtures/vcr_cassettes/slack.yml +43 -0
  63. data/spec/fixtures/vcr_cassettes/uber_getProducts.yml +60 -0
  64. data/spec/spec_helper.rb +11 -0
  65. metadata +241 -0
@@ -0,0 +1,98 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.honeybadger.io/v1/projects/3167/faults?auth_token=afaketoken
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Server:
18
+ - nginx
19
+ Date:
20
+ - Sun, 04 Jan 2015 05:41:06 GMT
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Transfer-Encoding:
24
+ - chunked
25
+ Connection:
26
+ - keep-alive
27
+ Vary:
28
+ - Accept-Encoding
29
+ Status:
30
+ - 200 OK
31
+ Strict-Transport-Security:
32
+ - max-age=31536000
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ Set-Cookie:
40
+ - _honeybadger_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTM4ZDllNDdiMDY3Njk4NmZkMDcwYzhjNjQ2OWMwMzIzBjsAVA%3D%3D--124cf4e6729ee5f15da2588ec9283da5e170c2b4;
41
+ path=/; secure; HttpOnly
42
+ X-Request-Id:
43
+ - cbc296dc-05aa-4d76-a372-eb9a1e94239a
44
+ X-Runtime:
45
+ - '2.092752'
46
+ body:
47
+ encoding: UTF-8
48
+ string: '{"results":[{"project_id":3167,"klass":"HoneybadgerTestingException","component":"application","action":"verify","environment":"development","resolved":true,"ignored":false,"created_at":"2013-10-02T14:23:21.116Z","comments_count":1,"message":"Testing
49
+ honeybadger via \"rake honeybadger:test\". If you can see this, it works.","notices_count":1,"last_notice_at":"2013-10-02T14:23:21.101Z","tags":[],"id":1563097,"assignee":null},{"project_id":3167,"klass":"NoMethodError","component":"portal","action":"show","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-02T19:54:43.127Z","comments_count":0,"message":"undefined
50
+ method `deals'' for nil:NilClass","notices_count":34,"last_notice_at":"2013-10-07T13:54:49.614Z","tags":[],"id":1569973,"assignee":null},{"project_id":3167,"klass":"NoMethodError","component":"admin/deals","action":"index","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-03T20:56:00.529Z","comments_count":0,"message":"undefined
51
+ method `name'' for nil:NilClass","notices_count":2,"last_notice_at":"2014-06-05T20:26:05.385Z","tags":[],"id":1590813,"assignee":null},{"project_id":3167,"klass":"Foursquare2::APIError","component":"admin/deals","action":"show","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-04T20:07:40.087Z","comments_count":0,"message":"other:
52
+ Must provide parameter venueId (400)","notices_count":50,"last_notice_at":"2014-11-18T19:00:35.983Z","tags":[],"id":1608448,"assignee":null},{"project_id":3167,"klass":"MultiJson::DecodeError","component":"admin/deals","action":"show","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-04T20:08:43.640Z","comments_count":0,"message":"757:
53
+ unexpected token at ''\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003c!DOCTYPE
54
+ html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"\u003e\n\u003chtml\u003e\n \u003chead\u003e\n \u003ctitle\u003e503
55
+ No healthy backends\u003c/title\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003ch1\u003eError
56
+ 503 No healthy backends\u003c/h1\u003e\n \u003cp\u003eNo healthy backends\u003c/p\u003e\n \u003ch3\u003eGuru
57
+ Meditation:\u003c/h3\u003e\n \u003cp\u003eXID: 2595686802\u003c/p\u003e\n \u003chr\u003e\n \u003cp\u003eVarnish
58
+ cache server\u003c/p\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n''","notices_count":2,"last_notice_at":"2013-10-04T20:08:44.290Z","tags":[],"id":1608469,"assignee":null},{"project_id":3167,"klass":"NameError","component":null,"action":null,"environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-06T15:10:39.295Z","comments_count":0,"message":"uninitialized
59
+ constant Jobs::CheckForUngeocodedDeals","notices_count":1,"last_notice_at":"2013-10-06T15:10:39.282Z","tags":[],"id":1628541,"assignee":null},{"project_id":3167,"klass":"NoMethodError","component":null,"action":null,"environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-07T10:30:21.831Z","comments_count":0,"message":"undefined
60
+ method `perform'' for Jobs::CheckForUngeocodedDeals:Class","notices_count":1,"last_notice_at":"2013-10-07T10:30:21.820Z","tags":[],"id":1637349,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/deals","action":"index","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-07T14:02:01.586Z","comments_count":0,"message":"Mysql2::Error:
61
+ Lost connection to MySQL server during query: SELECT `locations`.* FROM `locations` WHERE
62
+ `locations`.`id` = 3596 LIMIT 1","notices_count":4,"last_notice_at":"2013-11-26T14:29:56.279Z","tags":[],"id":1639607,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/reservations","action":"geo","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-07T19:37:50.792Z","comments_count":0,"message":"Mysql2::Error:
63
+ Lost connection to MySQL server during query: SELECT `cities`.* FROM `cities` WHERE
64
+ `cities`.`id` = 1 LIMIT 1","notices_count":32,"last_notice_at":"2014-04-15T19:28:38.959Z","tags":[],"id":1645856,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/reservations","action":"geo","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-07T20:28:39.553Z","comments_count":0,"message":"Mysql2::Error:
65
+ Lost connection to MySQL server during query: SELECT `users`.* FROM `users` WHERE
66
+ `users`.`id` = 370064 LIMIT 1","notices_count":36,"last_notice_at":"2014-04-15T19:26:51.343Z","tags":[],"id":1646919,"assignee":null},{"project_id":3167,"klass":"NoMethodError","component":"admin/daily_content","action":"show_email","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-08T21:39:49.184Z","comments_count":0,"message":"undefined
67
+ method `name'' for nil:NilClass","notices_count":1,"last_notice_at":"2013-10-08T21:39:49.165Z","tags":[],"id":1668099,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"portal","action":"show","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-11T12:46:45.533Z","comments_count":0,"message":"NoMethodError:
68
+ undefined method `fields'' for nil:NilClass: SELECT `ratings`.* FROM `ratings` WHERE
69
+ `ratings`.`location_id` = 3038 AND (ratings.comments IS NOT NULL AND LENGTH(ratings.comments)
70
+ \u003e 4) ORDER BY ratings.created_at DESC LIMIT 5","notices_count":7,"last_notice_at":"2014-05-05T14:27:59.503Z","tags":[],"id":1713397,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/locations","action":"index","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-11T20:42:51.804Z","comments_count":0,"message":"Mysql2::Error:
71
+ Lost connection to MySQL server during query: SELECT `cities`.* FROM `cities` WHERE
72
+ `cities`.`id` = 1 LIMIT 1","notices_count":5,"last_notice_at":"2014-05-06T16:08:05.787Z","tags":[],"id":1720931,"assignee":null},{"project_id":3167,"klass":"NoMethodError","component":"portal","action":"show","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-11T21:13:22.149Z","comments_count":0,"message":"undefined
73
+ method `deal_extension'' for nil:NilClass","notices_count":2,"last_notice_at":"2013-10-11T21:13:28.380Z","tags":[],"id":1721320,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/deals","action":"show","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-16T14:40:09.434Z","comments_count":0,"message":"Mysql2::Error:
74
+ Lost connection to MySQL server during query: SELECT COUNT(*) FROM `claims` WHERE
75
+ `claims`.`deal_id` = 1808 AND `claims`.`type` = ''EmailClaim'' AND (error
76
+ = ''false'' OR error IS NULL)","notices_count":1,"last_notice_at":"2013-10-16T14:40:09.400Z","tags":[],"id":1819734,"assignee":null},{"project_id":3167,"klass":"NoMethodError","component":"admin/articles","action":"new","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-18T20:50:02.451Z","comments_count":0,"message":"undefined
77
+ method `[]'' for nil:NilClass","notices_count":1,"last_notice_at":"2013-10-18T20:50:02.378Z","tags":[],"id":1875098,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/locations","action":"index","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-23T17:48:22.037Z","comments_count":0,"message":"Mysql2::Error:
78
+ Lost connection to MySQL server during query: SELECT `locations`.* FROM `locations` WHERE
79
+ `locations`.`id` = 2916 LIMIT 1","notices_count":3,"last_notice_at":"2013-12-13T16:09:42.419Z","tags":[],"id":1947856,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/daily_content","action":"edit","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-24T19:26:27.647Z","comments_count":0,"message":"Mysql2::Error:
80
+ MySQL server has gone away: SELECT COUNT(*) FROM `daily_content` WHERE `daily_content`.`page_type`
81
+ = ''Shoppe National Email''","notices_count":6,"last_notice_at":"2014-05-15T14:54:52.126Z","tags":[],"id":1966829,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/daily_content","action":"content_options","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-24T20:41:17.983Z","comments_count":0,"message":"Mysql2::Error:
82
+ Lost connection to MySQL server during query: SELECT `shoppe_products`.*
83
+ FROM `shoppe_products` WHERE (deleted_at IS NULL AND (available_on IS NOT
84
+ NULL AND CAST(available_on AS DATE) \u003c= ''2013-12-05'') AND (available_until
85
+ IS NULL OR CAST(available_until AS DATE) \u003e= ''2013-12-05'')) AND (shoppe_artist_id
86
+ IS NOT NULL) AND (name LIKE ''%%'') ORDER BY available_on DESC LIMIT 100","notices_count":2,"last_notice_at":"2013-12-04T14:26:59.451Z","tags":[],"id":1968249,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/daily_content","action":"edit","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-26T02:11:13.946Z","comments_count":0,"message":"Mysql2::Error:
87
+ Lost connection to MySQL server during query: SELECT `cities`.* FROM `cities`","notices_count":1,"last_notice_at":"2013-10-26T02:11:13.905Z","tags":[],"id":1986521,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/deals","action":"index","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-26T02:11:17.186Z","comments_count":0,"message":"Mysql2::Error:
88
+ Lost connection to MySQL server during query: SELECT `cities`.* FROM `cities` WHERE
89
+ `cities`.`id` = 13 LIMIT 1","notices_count":2,"last_notice_at":"2014-01-31T21:51:13.248Z","tags":[],"id":1986531,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/daily_content","action":"content_options","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-28T16:15:54.380Z","comments_count":0,"message":"Mysql2::Error:
90
+ MySQL server has gone away: SHOW TABLES","notices_count":3,"last_notice_at":"2014-05-27T16:52:17.111Z","tags":[],"id":2018760,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/daily_content","action":"content_options","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-28T16:15:54.431Z","comments_count":0,"message":"Mysql2::Error:
91
+ Lost connection to MySQL server during query: SELECT `cities`.* FROM `cities` WHERE
92
+ `cities`.`id` IN (5, 9, 11, 1, 6, 12, 14, 4, 2, 10, 17, 19, 7, 3, 8)","notices_count":1,"last_notice_at":"2013-10-28T16:15:54.317Z","tags":[],"id":2018761,"assignee":null},{"project_id":3167,"klass":"ActiveRecord::StatementInvalid","component":"admin/deals","action":"index","environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-29T20:17:08.404Z","comments_count":0,"message":"NoMethodError:
93
+ undefined method `fields'' for nil:NilClass: SELECT COUNT(*) FROM `deals` WHERE
94
+ `deals`.`privileges_count` = 0 AND `deals`.`visible` = 0","notices_count":6,"last_notice_at":"2014-04-29T18:41:53.327Z","tags":[],"id":2040164,"assignee":null},{"project_id":3167,"klass":"ArgumentError","component":null,"action":null,"environment":"production","resolved":true,"ignored":false,"created_at":"2013-10-29T22:06:52.826Z","comments_count":0,"message":"invalid
95
+ %-encoding (Vincent%2C%20we%20are%20excited%20to%20re-feature%20Vinny%u2019s%20New%20York%20Pizza%20%26%20Italian%20Grill%20for%20a%203%20month%20run.%20%0A%0APlease%20review%20the%20reservation%20form%20for%20accuracy.%20Once%20done%2C%20sign%20electronically%20with%20your%20mouse%20and%20click%20%27submit%27.%20%0A%0AWe%20will%20launch%20your%20new%20feature%20on%20Sunday%2C%20August%2010th.%20%0A%0AThanks%21)","notices_count":8,"last_notice_at":"2014-07-28T21:39:56.859Z","tags":[],"id":2042146,"assignee":null}],"total_count":158,"current_page":1,"num_pages":7}'
96
+ http_version:
97
+ recorded_at: Sun, 04 Jan 2015 05:41:06 GMT
98
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://mandrillapp.com/api/1.0/messages/send.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"key":"fakekey","message":{"text":"testing","subject":"testing","from_email":"test@test.com","to":[{"email":"test@example.com"}]}}'
9
+ headers:
10
+ User-Agent:
11
+ - apiture-rb/0.1.5
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.8.0
23
+ Date:
24
+ - Mon, 09 Nov 2015 13:40:10 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Vary:
30
+ - Accept-Encoding
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Allow-Methods:
34
+ - POST, GET, OPTIONS
35
+ Access-Control-Allow-Headers:
36
+ - Content-Type
37
+ Access-Control-Allow-Credentials:
38
+ - 'false'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '[{"email":"test@example.com","status":"sent","_id":"46223c56391d4f31a8079aa69eb125aa","reject_reason":null}]'
42
+ http_version:
43
+ recorded_at: Mon, 09 Nov 2015 13:40:10 GMT
44
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://mandrillapp.com/api/1.0/users/ping.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"key":"fakekey"}'
9
+ headers:
10
+ User-Agent:
11
+ - apiture-rb/0.1.5
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.8.0
23
+ Date:
24
+ - Mon, 09 Nov 2015 13:40:08 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Vary:
30
+ - Accept-Encoding
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Allow-Methods:
34
+ - POST, GET, OPTIONS
35
+ Access-Control-Allow-Headers:
36
+ - Content-Type
37
+ Access-Control-Allow-Credentials:
38
+ - 'false'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '"PONG!"'
42
+ http_version:
43
+ recorded_at: Mon, 09 Nov 2015 13:40:08 GMT
44
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.pivotaltracker.com/services/v5/projects/1053124/stories
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Testing Pivotal API","story_type":"chore"}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ X-Trackertoken:
13
+ - afaketoken
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Transfer-Encoding:
22
+ - chunked
23
+ Status:
24
+ - 200 OK
25
+ X-Tracker-Project-Version:
26
+ - '17'
27
+ X-Ua-Compatible:
28
+ - IE=Edge,chrome=1
29
+ Etag:
30
+ - '"3153849c2aa6910b84051fb3f95aa916"'
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Request-Id:
34
+ - f000300655795ace684e5ce0287aa024
35
+ X-Runtime:
36
+ - '0.209003'
37
+ Date:
38
+ - Sun, 04 Jan 2015 03:27:51 GMT
39
+ X-Rack-Cache:
40
+ - invalidate, pass
41
+ X-Powered-By:
42
+ - Phusion Passenger 4.0.41
43
+ Server:
44
+ - nginx/1.6.0 + Phusion Passenger 4.0.41
45
+ Access-Control-Allow-Origin:
46
+ - "*"
47
+ Access-Control-Allow-Credentials:
48
+ - 'false'
49
+ Access-Control-Allow-Methods:
50
+ - GET, POST, PUT, DELETE, OPTIONS
51
+ Access-Control-Allow-Headers:
52
+ - X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is
53
+ X-Tracker-Client-Pinger-Interval:
54
+ - '8'
55
+ body:
56
+ encoding: UTF-8
57
+ string: '{"kind":"story","id":85381528,"project_id":1053124,"name":"Testing
58
+ Pivotal API","story_type":"chore","current_state":"unscheduled","requested_by_id":371381,"owner_ids":[],"labels":[],"created_at":"2015-01-04T03:27:51Z","updated_at":"2015-01-04T03:27:51Z","url":"https://www.pivotaltracker.com/story/show/85381528"}'
59
+ http_version:
60
+ recorded_at: Sun, 04 Jan 2015 03:27:52 GMT
61
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,43 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://hooks.slack.com/services/abcd/efgh/ijkl
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"text":"Testing","username":"TestBot","attachments":[{"fallback":"test
9
+ fallback text","text":"test text","pretext":"test pretext","fields":[{"title":"test
10
+ field 1","value":"test value 1"},{"title":"test field 2","value":"test value
11
+ 2"}]}]}'
12
+ headers:
13
+ Content-Type:
14
+ - application/json
15
+ response:
16
+ status:
17
+ code: 200
18
+ message: OK
19
+ headers:
20
+ Access-Control-Allow-Origin:
21
+ - "*"
22
+ Content-Type:
23
+ - text/html
24
+ Date:
25
+ - Sun, 04 Jan 2015 21:21:29 GMT
26
+ Server:
27
+ - Apache
28
+ Strict-Transport-Security:
29
+ - max-age=31536000; includeSubDomains; preload
30
+ Vary:
31
+ - Accept-Encoding
32
+ X-Frame-Options:
33
+ - SAMEORIGIN
34
+ Content-Length:
35
+ - '2'
36
+ Connection:
37
+ - keep-alive
38
+ body:
39
+ encoding: UTF-8
40
+ string: ok
41
+ http_version:
42
+ recorded_at: Sun, 04 Jan 2015 21:21:29 GMT
43
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.uber.com/v1/products?latitude=33.776776&longitude=-84.389683
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - apiture-rb/0.1.3
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Token TEST_SERVER_TOKEN
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Fri, 18 Sep 2015 04:02:36 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - '2079'
29
+ Connection:
30
+ - keep-alive
31
+ X-Rate-Limit-Remaining:
32
+ - '999'
33
+ Content-Language:
34
+ - en
35
+ Etag:
36
+ - '"8b714beb16ec06c6c555ae761aee791ecc20ea3a"'
37
+ X-Rate-Limit-Reset:
38
+ - '1442552400'
39
+ X-Rate-Limit-Limit:
40
+ - '1000'
41
+ X-Uber-App:
42
+ - uberex-nonsandbox
43
+ Strict-Transport-Security:
44
+ - max-age=0
45
+ X-Xss-Protection:
46
+ - 1; mode=block
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"products":[{"capacity":4,"product_id":"6d898741-0175-4c71-ad5f-93fc66270d6a","price_details":{"service_fees":[{"fee":1.0,"name":"Safe
50
+ rides fee"}],"cost_per_minute":0.16,"distance_unit":"mile","minimum":5.0,"cost_per_distance":0.78,"base":1.15,"cancellation_fee":6.0,"currency_code":"USD"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-uberx.png","display_name":"uberX","description":"The
51
+ low-cost Uber"},{"capacity":6,"product_id":"171a12a5-5b08-40cc-bfb0-416b9256147a","price_details":{"service_fees":[{"fee":1.0,"name":"Safe
52
+ rides fee"}],"cost_per_minute":0.3,"distance_unit":"mile","minimum":8.0,"cost_per_distance":1.9,"base":3.0,"cancellation_fee":6.0,"currency_code":"USD"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-uberxl2.png","display_name":"uberXL","description":"Low-Cost
53
+ Rides for Larger Groups"},{"capacity":4,"product_id":"3d3dff24-c799-45ba-ad08-3d72c5b843b1","price_details":{"service_fees":[{"fee":1.0,"name":"Safe
54
+ rides fee"}],"cost_per_minute":0.35,"distance_unit":"mile","minimum":10.0,"cost_per_distance":2.0,"base":4.0,"cancellation_fee":10.0,"currency_code":"USD"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-uberselect.png","display_name":"UberSELECT","description":"The
55
+ Next Step Towards Luxury"},{"capacity":4,"product_id":"aff35634-a71e-470f-8c7b-703dec02e15b","price_details":{"service_fees":[],"cost_per_minute":0.4,"distance_unit":"mile","minimum":15.0,"cost_per_distance":3.25,"base":7.0,"cancellation_fee":10.0,"currency_code":"USD"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-black.png","display_name":"UberBLACK","description":"The
56
+ original Uber"},{"capacity":6,"product_id":"852310f8-a778-4191-bb7b-8c5f9a9899f6","price_details":{"service_fees":[],"cost_per_minute":0.5,"distance_unit":"mile","minimum":25.0,"cost_per_distance":4.0,"base":14.0,"cancellation_fee":10.0,"currency_code":"USD"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-suv.png","display_name":"UberSUV","description":"Room
57
+ for everyone"}]}'
58
+ http_version:
59
+ recorded_at: Fri, 18 Sep 2015 04:02:36 GMT
60
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,11 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'apiture'
5
+ require 'vcr'
6
+ require 'pry'
7
+
8
+ VCR.configure do |c|
9
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
10
+ c.hook_into :webmock
11
+ end
metadata ADDED
@@ -0,0 +1,241 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apiture
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Calvin Yu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.11.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.11.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 11.1.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 11.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.4.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.9.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.9.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.20.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.20.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: faraday
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.9.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: faraday_middleware
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.10.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.10.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: multi_json
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.3'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.3'
125
+ description: 'Create clients for REST APIs from their Swagger specification '
126
+ email:
127
+ - me@sourcebender.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - Gemfile
134
+ - LICENSE
135
+ - README.md
136
+ - Rakefile
137
+ - apiture.gemspec
138
+ - lib/apiture.rb
139
+ - lib/apiture/api_base.rb
140
+ - lib/apiture/api_builder.rb
141
+ - lib/apiture/api_error.rb
142
+ - lib/apiture/api_group.rb
143
+ - lib/apiture/data_model.rb
144
+ - lib/apiture/endpoint.rb
145
+ - lib/apiture/middleware/auth/api_key.rb
146
+ - lib/apiture/middleware/auth/basic.rb
147
+ - lib/apiture/middleware/auth/oauth2.rb
148
+ - lib/apiture/middleware/convert_json_body.rb
149
+ - lib/apiture/middleware/debug.rb
150
+ - lib/apiture/middleware/set_body_parameter.rb
151
+ - lib/apiture/middleware/set_header.rb
152
+ - lib/apiture/middleware/set_parameter_base.rb
153
+ - lib/apiture/middleware/set_path_parameter.rb
154
+ - lib/apiture/middleware/set_query_parameter.rb
155
+ - lib/apiture/middleware_builder.rb
156
+ - lib/apiture/middleware_stack.rb
157
+ - lib/apiture/request_context.rb
158
+ - lib/apiture/swagger/data_type_field.rb
159
+ - lib/apiture/swagger/definition.rb
160
+ - lib/apiture/swagger/external_docs.rb
161
+ - lib/apiture/swagger/info.rb
162
+ - lib/apiture/swagger/node.rb
163
+ - lib/apiture/swagger/operation.rb
164
+ - lib/apiture/swagger/parameter.rb
165
+ - lib/apiture/swagger/parser.rb
166
+ - lib/apiture/swagger/path.rb
167
+ - lib/apiture/swagger/property.rb
168
+ - lib/apiture/swagger/security.rb
169
+ - lib/apiture/swagger/security_definition.rb
170
+ - lib/apiture/swagger/specification.rb
171
+ - lib/apiture/uri.rb
172
+ - lib/apiture/utils/inflections.rb
173
+ - lib/apiture/version.rb
174
+ - spec/apiture/api_builder_spec.rb
175
+ - spec/apiture/swagger/parser_spec.rb
176
+ - spec/apiture/swagger/specification_spec.rb
177
+ - spec/apiture_spec.rb
178
+ - spec/files/github.json
179
+ - spec/files/harvest.json
180
+ - spec/files/honeybadger.json
181
+ - spec/files/mandrill.json
182
+ - spec/files/pivotal_tracker.json
183
+ - spec/files/slack.json
184
+ - spec/files/uber.json
185
+ - spec/fixtures/vcr_cassettes/github_checkAuthorization.yml
186
+ - spec/fixtures/vcr_cassettes/github_getUser.yml
187
+ - spec/fixtures/vcr_cassettes/harvest_invoiceList.yml
188
+ - spec/fixtures/vcr_cassettes/honeybadger.yml
189
+ - spec/fixtures/vcr_cassettes/mandrill_messageSend.yml
190
+ - spec/fixtures/vcr_cassettes/mandrill_userPing.yml
191
+ - spec/fixtures/vcr_cassettes/pivotal_tracker_create_story.yml
192
+ - spec/fixtures/vcr_cassettes/slack.yml
193
+ - spec/fixtures/vcr_cassettes/uber_getProducts.yml
194
+ - spec/spec_helper.rb
195
+ homepage: http://github.com/cyu/apiture
196
+ licenses:
197
+ - MIT
198
+ metadata: {}
199
+ post_install_message:
200
+ rdoc_options: []
201
+ require_paths:
202
+ - lib
203
+ required_ruby_version: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: '0'
208
+ required_rubygems_version: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
213
+ requirements: []
214
+ rubyforge_project:
215
+ rubygems_version: 2.4.5
216
+ signing_key:
217
+ specification_version: 4
218
+ summary: ''
219
+ test_files:
220
+ - spec/apiture/api_builder_spec.rb
221
+ - spec/apiture/swagger/parser_spec.rb
222
+ - spec/apiture/swagger/specification_spec.rb
223
+ - spec/apiture_spec.rb
224
+ - spec/files/github.json
225
+ - spec/files/harvest.json
226
+ - spec/files/honeybadger.json
227
+ - spec/files/mandrill.json
228
+ - spec/files/pivotal_tracker.json
229
+ - spec/files/slack.json
230
+ - spec/files/uber.json
231
+ - spec/fixtures/vcr_cassettes/github_checkAuthorization.yml
232
+ - spec/fixtures/vcr_cassettes/github_getUser.yml
233
+ - spec/fixtures/vcr_cassettes/harvest_invoiceList.yml
234
+ - spec/fixtures/vcr_cassettes/honeybadger.yml
235
+ - spec/fixtures/vcr_cassettes/mandrill_messageSend.yml
236
+ - spec/fixtures/vcr_cassettes/mandrill_userPing.yml
237
+ - spec/fixtures/vcr_cassettes/pivotal_tracker_create_story.yml
238
+ - spec/fixtures/vcr_cassettes/slack.yml
239
+ - spec/fixtures/vcr_cassettes/uber_getProducts.yml
240
+ - spec/spec_helper.rb
241
+ has_rdoc: