Sha256: cdc5f4f27ff0ec19c04bcd580e4920d876c8ee52b02b8d659cfe67e29d2a38a6
Contents?: true
Size: 849 Bytes
Versions: 1
Compression:
Stored size: 849 Bytes
Contents
module CoderWally # Builds the CoderWall object from the response class Builder # Instantiate class def initialize end # parse badges from data def parse_badges(badges) badges.map { |badge| create_new_badge(badge) } if badges end # create a new badge object def create_new_badge(badge) Badge.new(badge) end # parse account information from data def parse_accounts(accounts) Account.new(accounts) if accounts end # parse user information from data def parse_user(data) User.new(data) end # build CoderWall object from API response def build(response) badges = parse_badges(response['badges']) accounts = parse_accounts(response['accounts']) user = parse_user(response) CoderWall.new badges, user, accounts end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coder_wally-0.1.2 | lib/coder_wally/builder.rb |