This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- request --> | |
<soap:Envelope xmlns:ns0="http://www.ebxml.org/namespaces/messageHeader" xmlns:ns1="http://www.w3.org/2000/09/xmldsig#" xmlns:ns2="http://webservices.sabre.com/sabreXML/RCP/common" xmlns:ns3="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns4="http://webservices.sabre.com/sabreXML/RCP/ota" xmlns:ns5="http://www.w3.org/1999/xlink" xmlns:ns6="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ns7="http://webservices.sabre.com/sabreXML/RCP/rmb" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> | |
<soap:Header> | |
<ns6:Security> | |
<ns6:BinarySecurityToken>Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/ACPCRTD!ICESMSLB\/CRT.LB!-3153976901799900026!331067!0</ns6:BinarySecurityToken> | |
</ns6:Security> | |
<ns0:MessageHeader> | |
<ns0:From> | |
<ns0:PartyId>Loco2</ns0:PartyId> | |
</ns0:From> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
package User; | |
sub new { | |
my $class = shift; | |
my $self = {}; | |
$self->{name} = shift; | |
bless $self, $class; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "with_args" # TBA | |
class User | |
with_args String, | |
def name=(name) | |
@name = name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= simple_form_for @machine_visit_form do |f| | |
= f.error_notification | |
= f.input :refill_id, as: :hidden | |
= f.input :refill_date, as: :date | |
= f.input :refill_counter, as: :decimal, input_html: {value: number_with_precision(f.object.refill_counter, precision: 2) } | |
= f.fields_for :refill_line_items do |ff| | |
.well | |
= "#{ff.object.product_name}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/code/rover[master]% rspec tspec | |
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... | |
Finished in 1.53 seconds | |
543 examples, 0 failures | |
Randomized with seed 50567 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserOption < Slop::Option | |
def authenticated? | |
user = User.find_by_username(value) | |
user && user.authenticate(opts[:password]) | |
end | |
end | |
opts = Slop.parse do | |
on :user=. 'Your user name', builder: UserOption | |
on :password=, 'Your password' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
module MethodFromClass | |
def self.included(klass) | |
Object.send(:define_method, klass.to_s) do |*args| | |
klass.new(*args) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'json' | |
module ResponseMethods | |
def json_body | |
JSON.parse(self.body) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# wat | |
def reload_require(file) | |
path = File.expand_path(file) | |
$LOADED_FEATURES.delete(path) | |
require path | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class UserTest < ActiveSupport::TestCase | |
test 'full_name returns contatenated first and last name' do | |
user = build(:user, first_name: 'foo', last_name: 'bar') | |
assert_equal 'foo bar', user.full_name | |
end | |
end |
NewerOlder