<commit_before>//
//  ShippingAddress.swift
//  Stripe
//
//  Created by <NAME> on 4/15/17.
//
//

import Foundation
import Vapor
import Helpers

/*
 Shipping Address
 https://stripe.com/docs/api/curl#charge_object-shipping-address
 */

public final class ShippingAddress: StripeModelProtocol {
    
    public var city: String?
    public var country: String?
    public var addressLine1: String?
    public var addressLine2: String?
    public var postalCode: String?
    public var state: String?
    
    public init() { }
    
    public init(node: Node) throws {
        self.city = try node.get("city")
        self.country = try node.get("country")
        self.addressLine1 = try node.get("line1")
        self.addressLine2 = try node.get("line2")
        self.postalCode = try node.get("postal_code")
        self.state = try node.get("state")
    }
    
    public func makeNode(in context: Context?) throws -> Node {
        let object: [String : Any?] = [
            "city": self.city,
            "country": self.country,
            "line1": self.addressLine1,
            "line2": self.addressLine2,
            "postal_code": self.postalCode,
            "state": self.state
        ]
        return try Node(node: object)
    }
    
}<commit_msg>cleanup<commit_after>//
//  ShippingAddress.swift
//  Stripe
//
//  Created by <NAME> on 4/15/17.
//
//

import Foundation
import Vapor
import Helpers

/**
 Shipping Address
 https://stripe.com/docs/api/curl#charge_object-shipping-address
 */

public final class ShippingAddress: StripeModelProtocol {
    
    public var city: String?
    public var country: String?
    public var addressLine1: String?
    public var addressLine2: String?
    public var postalCode: String?
    public var state: String?
    
    public init() { }
    
    public init(node: Node) throws {
        self.city = try node.get("city")
        self.country = try node.get("country")
        self.addressLine1 = try node.get("line1")
        self.addressLine2 = try node.get("line2")
        self.postalCode = try node.get("postal_code")
        self.state = try node.get("state")
    }
    
    public func makeNode(in context: Context?) throws -> Node {
        let object: [String : Any?] = [
            "city": self.city,
            "country": self.country,
            "line1": self.addressLine1,
            "line2": self.addressLine2,
            "postal_code": self.postalCode,
            "state": self.state
        ]
        return try Node(node: object)
    }
}
{'fraction_non_alphanumeric': 0.12023809523809524, 'fraction_numerical': 0.011904761904761904, 'mean_word_length': 2.232051282051282, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2357926', 'n_tokens_mistral': 783, 'n_tokens_neox': 763, 'n_words': 194}