-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5baff4f0.ef1c90fe.js
1 lines (1 loc) · 7.96 KB
/
5baff4f0.ef1c90fe.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{152:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return l})),n.d(t,"metadata",(function(){return s})),n.d(t,"rightToc",(function(){return u})),n.d(t,"default",(function(){return p}));var a=n(2),r=n(6),c=(n(0),n(229)),o=n(236),i=n(237),l={id:"ruby",title:"Ruby",hide_title:!0,sidebar_label:"Ruby"},s={id:"Instalacao/ruby",isDocsHomePage:!1,title:"Ruby",description:"Ruby",source:"@site/docs\\Instalacao\\Ruby.md",permalink:"/docs/Instalacao/ruby",sidebar_label:"Ruby",sidebar:"someSidebar",previous:{title:"GO",permalink:"/docs/Instalacao/go"},next:{title:"Delphi",permalink:"/docs/Instalacao/delphi"}},u=[{value:"Instalando via RubyGems",id:"instalando-via-rubygems",children:[]},{value:"Testado com",id:"testado-com",children:[]},{value:"Uso b\xe1sico",id:"uso-b\xe1sico",children:[]},{value:"Exemplos",id:"exemplos",children:[]},{value:"Testes",id:"testes",children:[]}],b={rightToc:u};function p(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},b,n,{components:t,mdxType:"MDXLayout"}),Object(c.b)("h1",{className:"titulo"},"Ruby"),Object(c.b)("div",{className:"subtitulo"},Object(c.b)("p",null,"Nossa API \xe9 ",Object(c.b)("a",{href:"https://en.wikipedia.org/wiki/Representational_state_transfer"},"RESTful"),"\ne responde em ",Object(c.b)("a",{href:"https://www.json.org/json-en.html"},"JSON"),". A Gerencianet utiliza ",Object(c.b)("a",{href:"https://oauth.net/"},"OAuth")," para fornecer acesso autorizado \xe0 API.\nNossa SDK de Ruby j\xe1 est\xe1 preparada para realizar essa autentica\xe7\xe3o automaticamente."),Object(c.b)("p",null,"A seguir, confira os procedimentos para instala\xe7\xe3o da SDK da Gerencianet em Ruby:"),Object(c.b)("h2",{id:"instalando-via-rubygems"},"Instalando via RubyGems"),Object(c.b)("p",null,"Adicione esta linha ao Gemfile da sua aplica\xe7\xe3o:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),"gem 'gerencianet'\n")),Object(c.b)("p",null,"E ent\xe3o execute:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),"$ bundle\n")),Object(c.b)("p",null,"Ou instale-o como:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),"$ gem install gerencianet\n")),Object(c.b)("h2",{id:"testado-com"},"Testado com"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},"Ruby ",Object(c.b)("inlineCode",{parentName:"li"},"2.1.0"))),Object(c.b)("h2",{id:"uso-b\xe1sico"},"Uso b\xe1sico"),Object(c.b)(o.a,{defaultValue:"ruby",values:[{label:"Ruby",value:"ruby"}],mdxType:"Tabs"},Object(c.b)(i.a,{value:"ruby",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-java"}),'require "gerencianet"\n\noptions = {\n client_id: "client_id",\n client_secret: "client_secret",\n sandbox: true\n}\n\ngerencianet = Gerencianet.new(options)\n\ncharge = {\n items: [{\n name: "Product A",\n value: 1000,\n amount: 2\n }]\n}\n\nresponse = gerencianet.create_charge(body: charge)\n}\n')))),Object(c.b)("h2",{id:"exemplos"},"Exemplos"),Object(c.b)("p",null,"Voc\xea pode executar os exemplos dentro do diret\xf3rio ",Object(c.b)("inlineCode",{parentName:"p"},"examples")," com:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),"$ ruby examples/create_charge.rb\n")),Object(c.b)("p",null,"Lembre-se de definir as credenciais corretas dentro de ",Object(c.b)("inlineCode",{parentName:"p"},"examples/credentials.rb")," antes de executar."),Object(c.b)("h2",{id:"testes"},"Testes"),Object(c.b)("p",null,"Para executar os testes, basta executar rspec:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),"$ rspec\n")),Object(c.b)("p",null,"Ou usar ",Object(c.b)("inlineCode",{parentName:"p"},"guard")," para monitorar arquivos e executar automaticamente rspec:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),"$ guard -n false -c\n"))))}p.isMDXComponent=!0},229:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return m}));var a=n(0),r=n.n(a);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},c=Object.keys(e);for(a=0;a<c.length;a++)n=c[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)n=c[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=r.a.createContext({}),u=function(e){var t=r.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},b=function(e){var t=u(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},d=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,o=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),b=u(n),d=a,m=b["".concat(o,".").concat(d)]||b[d]||p[d]||c;return n?r.a.createElement(m,i(i({ref:t},s),{},{components:n})):r.a.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,o=new Array(c);o[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var s=2;s<c;s++)o[s]=n[s];return r.a.createElement.apply(null,o)}return r.a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},233:function(e,t,n){"use strict";function a(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}t.a=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a(e))&&(r&&(r+=" "),r+=t);return r}},234:function(e,t,n){"use strict";var a=n(0);const r=Object(a.createContext)({tabGroupChoices:{},setTabGroupChoices:()=>{},isAnnouncementBarClosed:!1,closeAnnouncementBar:()=>{}});t.a=r},235:function(e,t,n){"use strict";var a=n(0),r=n(234);t.a=function(){return Object(a.useContext)(r.a)}},236:function(e,t,n){"use strict";var a=n(0),r=n.n(a),c=n(235),o=n(233),i=n(92),l=n.n(i);const s=37,u=39;t.a=function(e){const{block:t,children:n,defaultValue:i,values:b,groupId:p}=e,{tabGroupChoices:d,setTabGroupChoices:m}=Object(c.a)(),[f,O]=Object(a.useState)(i);if(null!=p){const e=d[p];null!=e&&e!==f&&b.some(t=>t.value===e)&&O(e)}const j=e=>{O(e),null!=p&&m(p,e)},y=[];return r.a.createElement("div",null,r.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(o.a)("tabs",{"tabs--block":t})},b.map(({value:e,label:t})=>r.a.createElement("li",{role:"tab",tabIndex:"0","aria-selected":f===e,className:Object(o.a)("tabs__item",l.a.tabItem,{"tabs__item--active":f===e}),key:e,ref:e=>y.push(e),onKeyDown:e=>((e,t,n)=>{switch(n.keyCode){case u:((e,t)=>{const n=e.indexOf(t)+1;e[n]?e[n].focus():e[0].focus()})(e,t);break;case s:((e,t)=>{const n=e.indexOf(t)-1;e[n]?e[n].focus():e[e.length-1].focus()})(e,t)}})(y,e.target,e),onFocus:()=>j(e),onClick:()=>j(e)},t))),r.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(n).filter(e=>e.props.value===f)[0]))}},237:function(e,t,n){"use strict";var a=n(0),r=n.n(a);t.a=function(e){return r.a.createElement("div",null,e.children)}}}]);